Beispiel #1
0
        public void AddParam(AstId id, DemiTasse.ast.AstType type)
        {
            if (GetParam(id) != null)
                throw new SymbolException("Param " + id.s + " already defined");

            _params.Add(new VarRec(id, type, VarRec.PARAM, _params.Count + 1));
        }
Beispiel #2
0
        public void AddClassVar(AstId vid, DemiTasse.ast.AstType type, AstExp e)
        {
            if(GetClassVar(vid) != null)
                throw new SymbolException("ClassVar " + vid.s + " already defined");

            _vars.Add(new VarRec(vid, type, VarRec.CLASS, _vars.Count+1, e));
        }
Beispiel #3
0
 public TypeVisitor(DemiTasse.symbol.SymbolTable symtab, ClassRec c, MethodRec m)
 {
     symTable = symtab;
     currClass = c;
     currMethod = m;
     hasReturn = false;
 }
Beispiel #4
0
        public void AddLocal(AstId vid, DemiTasse.ast.AstType type)
        {
            if (GetLocal(vid) != null)
                throw new SymbolException("Var " + vid.s + " already defined");

            _locals.Add(new VarRec(vid, type, VarRec.LOCAL,
            _locals.Count + 1));
        }
Beispiel #5
0
        public void AddMethod(AstId mid, DemiTasse.ast.AstType rtype)
        {
            if (_methods.ContainsKey(mid.s))
                throw new SymbolException("Method " + mid.s + " already defined");

            MethodRec m = new MethodRec(mid, rtype);

            _methods.Add(mid.s, m);
        }