Пример #1
0
        public static void AddToSubroutineSymbolTable(SymbolTableItem symbolTableItem)
        {
            var symbolTableItemNum = SymbolTable[VarScopeType.SUBROUTINE_LEVEL].Count(sti => sti.Kind == symbolTableItem.Kind);

            symbolTableItem.Number = symbolTableItemNum;
            SymbolTable[VarScopeType.SUBROUTINE_LEVEL].Add(symbolTableItem);
        }
Пример #2
0
        public static void AddToClassSymbolTable(SymbolTableItem symbolTableItem)
        {
            var symbolTableItemNum = SymbolTable[VarScopeType.CLASS_LEVEL].Count(sti => sti.Kind == symbolTableItem.Kind);

            symbolTableItem.Number = symbolTableItemNum;
            SymbolTable[VarScopeType.CLASS_LEVEL].Add(symbolTableItem);
        }
Пример #3
0
        public static SymbolTableItem Find(string varName)
        {
            SymbolTableItem result = null;

            result = SymbolTable[VarScopeType.SUBROUTINE_LEVEL].FirstOrDefault(si => si.Name == varName) ??
                     SymbolTable[VarScopeType.CLASS_LEVEL].FirstOrDefault(si => si.Name == varName);

            return(result);
        }