15 using System.Collections.Generic;
18 using ErrorManagement;
33 private List<Dictionary<string, Symbol>> table;
44 this.table =
new List<Dictionary<string, Symbol>>();
57 this.table.Add(
new Dictionary<string, Symbol>());
70 this.table.RemoveAt(this.table.Count - 1);
86 if (this.table[this.table.Count - 1].ContainsKey(
id))
88 Symbol s =
new Symbol(
id, this.table.Count - 1, type, isDynamic);
89 this.table[this.table.Count - 1].Add(id, s);
105 int scope = this.table.Count - 1;
109 if (this.table[scope].ContainsKey(
id))
110 return this.table[scope][id];
void Set()
Add a new scope
SymbolTable()
Constructor of SymbolTable.
Symbol Insert(string id, TypeExpression type, bool isDynamic)
Insert a new symbol in the current scope.
Abstract class that represents all different types.
Implementation of a symbol table.
This class represents a symbol associated with its identifier.
Symbol Search(string id)
Searches in the symbol table for a symbol matching the specified name.
void Reset()
Removes the last scope