Assign an integer expression to a variable
Inheritance: Statement
コード例 #1
0
 public virtual void Visit(Assign node)
 {
 }
コード例 #2
0
        void AssignStmt(out Statement assign)
        {
            Expression exp;
            Variable var;
            assign = null;
            Expect(1);
            var = new Variable(t.val);
            if (!SymbolTable.IsInScope(t.val) && !Options.BookVersion) {
            errors.SemErr(t.line, t.col, string.Format("Assignment to undeclared variable '{0}'",t.val));
            }

            Expect(17);
            Token tok = t;
            Expr(out exp);
            if (!ExpectInt(exp, tok, true)) {
            return;
            }

            assign = new Assign(var, (TypedExpression<int>)exp);
        }