#ifndef SYMTAB_STACKTABLE_H #define SYMTAB_STACKTABLE_H #include #include #include #include namespace SymTab { template< typename Element, typename ConflictFunction > class StackTable { public: StackTable(); void enterScope(); void leaveScope(); void add( Element *type ); void add( std::string fwdDeclName ); Element *lookup( std::string id ) const; void dump( std::ostream &os ) const; // debugging private: typedef std::pair< Element*, int > Entry; typedef std::map< std::string, std::stack< Entry > > TableType; ConflictFunction conflictFunction; TableType table; int scopeLevel; }; } // SymTab #include "StackTable.cc" #endif // SYMTAB_STACKTABLE_H