// Stephen Bassoli // CSE 124 Section 01 // Lab 3 #include #include #include #include #include "Variables.h" Variables::Variables() { Init = false; Declared = false; TableNumber = -1; } void Variables::Initialize() { if (!Declared) { cerr << "UNDECLARED IDENTIFIER\n"; exit(1); } Init = true; } void Variables::Declare(char* name) { static int Number = 0; if (isdigit(name[0])) { cerr << "VARIABLE CANNOT BEGIN WITH A NUMBER\n"; exit(1); } strcpy(Ident,name); Declared = true; TableNumber = Number; Number++; } char* Variables::ReturnIdent() { return Ident; } bool Variables::CheckInit() { return Init; } bool Variables::CheckDec() { return Declared; }