Beispiel #1
0
        ASTNode PRINT()
        {
            var node = new PrintNode();

            node.lexeme       = Consume("print", TokenType.KEYWORD);
            node.printedValue = EXPR();
            return(node);
        }
Beispiel #2
0
        public void VisitPrint(PrintNode prn)
        {
            int    temp   = this.depth;
            string spaces = IncreaseDepth();

            this.io.WriteLine($"{spaces}Print: (");
            prn.Expression.Visit(this);
            this.io.WriteLine($"{spaces})");
            this.depth = temp;
        }
Beispiel #3
0
        public void VisitPrint(PrintNode prn)
        {
            UnaryOperandNode expr = prn.Expression.Visit(this);

            this.io.WriteLine(expr.Value);
        }