public void Set(string name, VarInfo v) { if (table.ContainsKey(name)) { throw new Exception("Redeclaration of " + name); } table[name] = v; }
public override void ExitVardecl(ssuplParser.VardeclContext context) { // vardecl : TYPE ID string vname = context.ID().GetText(); string typestr = context.TYPE().GetText(); VarType vtype = stringToType(typestr); VarInfo vinfo = new VarInfo(vtype, label(), context.Start.Line); symtable.Set(vname, vinfo); }