Example #1
0
def test_write_symbol_table():
    ST = SymbolTable("")
    ST.DebugMode = True

    Content1 = {'Type': "int" , 'Attribute': 'static' , 'TokenLocation': (10,2) }
    ST.InsertSymbol("age", Content1)
    ST.PushNewScope();
    Content2 = {'Type': "float" , 'Attribute': None , 'TokenLocation': (11,2) }
    ST.InsertSymbol("temperature", Content2)
    Content2 = {'Type': "float" , 'Attribute': 'static' , 'TokenLocation': (12,2) }
    ST.InsertSymbol("t2", Content2)
    ST.PushNewScope();
    Content3 = {'Type': "char" , 'Attribute': None , 'TokenLocation': (13,2) }
    ST.InsertSymbol("letter", Content3)
    ST.PushNewScope();

    ST.WriteSymbolTableToFile("Debug.out")