Пример #1
0
        public override IAstNode VisitAssignStmt(MicroCParser.AssignStmtContext context)
        {
            var label  = ++_label;
            var name   = context.IDENT().GetText();
            var symbol = _symbolTable.LookupSymbol(name);
            var ident  = new Identifier(name, symbol.Type, symbol.Id);
            // TODO: Type check the symbol

            VarAccess left  = new VarAccess(ident);
            IAExpr    right = Visit(context.a_expr()) as IAExpr;

            var assignStmt = new AssignStmt(left, right);

            assignStmt.Label = label;
            return(assignStmt);
        }