This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

...
 
Commits (2)
......@@ -7,21 +7,6 @@
#include "SymbolTableEntry.h"
using namespace std;
#define UNDEFINED -1 // Type codes
#define FUNCTION 8
#define INT 1
#define STR 2
#define INT_OR_STR 3
#define BOOL 4
#define INT_OR_BOOL 5
#define STR_OR_BOOL 6
#define INT_OR_STR_OR_BOOL 7
#define NOT_APPLICABLE -1
#define ARITHMETIC 10
#define LOGICAL 11
#define RELATIONAL 12
class SYMBOL_TABLE
{
private:
......
......@@ -2,24 +2,62 @@
#define SYMBOL_TABLE_ENTRY_H
#include <string>
#include <ostream>
#include <stdexcept>
using namespace std;
#define UNDEFINED -1
#define UNDEFINED -1 // Type codes
#define FUNCTION 8
#define INT 1
#define STR 2
#define INT_OR_STR 3
#define BOOL 4
#define INT_OR_BOOL 5
#define STR_OR_BOOL 6
#define INT_OR_STR_OR_BOOL 7
#define NOT_APPLICABLE -1
typedef struct
#define ARITHMETIC 10
#define LOGICAL 11
#define RELATIONAL 12
union TYPE_VALUE{
char* text;
bool boolean;
int number;
};
struct TYPE_INFO
{
//value can be int, bool or str not sure how to do this correctly
int value; //place holder
TYPE_VALUE value;
// one of the above type codes
int type;
// numParams and returnType only applicable if type == FUNCTION
int numParams;
int numParams;
int returnType;
// operatorType is only applicable if production is an operator
int operatorType;
} TYPE_INFO;
friend ostream& operator<<(ostream& os, const TYPE_INFO& rhs){
switch(rhs.type){
case INT:
os << rhs.value.number;
break;
case STR:
os << rhs.value.text;
break;
case BOOL:
os << rhs.value.boolean;
break;
default:
throw std::invalid_argument("invalid type at print");
}
return os;
}
};
class SYMBOL_TABLE_ENTRY
{
......