#ifndef SYMTAB_IDTABLE_H #define SYMTAB_IDTABLE_H #include #include #include #include #include "SynTree/SynTree.h" namespace SymTab { class IdTable { public: IdTable(); void enterScope(); void leaveScope(); void addDecl( DeclarationWithType *decl ); void lookupId( const std::string &id, std::list< DeclarationWithType* >& decls ) const; DeclarationWithType* lookupId( const std::string &id) const; void dump( std::ostream &os ) const; // debugging private: typedef std::pair< DeclarationWithType*, int > DeclEntry; typedef std::map< std::string, std::stack< DeclEntry > > InnerTableType; typedef std::map< std::string, InnerTableType > OuterTableType; OuterTableType table; int scopeLevel; }; } // namespace SymTab #endif // SYMTAB_IDTABLE_H