#pragma once #include #include #include #include #include "Token.h" namespace pim { namespace compiler { class VariableNotFoundException: public std::exception { char * error; public: VariableNotFoundException(std::string variable) { error = strdup(std::string("Could not find the variable \""+variable+"\" in the current scope").c_str()); } const char * what() const throw() { return error; } ~VariableNotFoundException() throw() {}; }; class SymbolNotFoundException: public std::exception { char * error; public: SymbolNotFoundException(std::string variable) { error = strdup(std::string("Could not find the symbol \""+variable+"\".").c_str()); } const char * what() const throw() { return error; } ~SymbolNotFoundException() throw() {}; }; class Type { enum { Integer = Token::IntegerSymbol, Decimal = Token::DecimalSymbol }; }; class Definition { public: std::string Name; int Type; int StackPosition; Definition(std::string name, int type, int position) : Type(type), Name(name), StackPosition(position) { } }; struct Label { std::string Name; int Position; }; class Scope { public: std::vector Definitions; std::vector