object IVisitor <object> .visit(ReadNode node)
        {
            Node child = node.getLeft();

            Console.Write(">>> ");
            string value = Console.ReadLine();

            if (child.type == Token.INT)
            {
                try {
                    int value_i = int.Parse(value);
                    SymbolTable.assign(child.value, value_i.ToString());
                }
                catch {
                    new RuntimeError(child, "Runtime Error: Could not parse interger from the input.");
                }
            }
            else
            {
                SymbolTable.assign(child.value, value);
            }
            return(null);
        }
Example #2
0
 object IVisitor <object> .visit(ReadNode node)
 {
     node.getLeft().accept(this);
     return(null);
 }