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

            node.lexeme       = Consume("print", TokenType.KEYWORD);
            node.printedValue = EXPR();
            return(node);
        }
Example #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;
        }
Example #3
0
        public void VisitPrint(PrintNode prn)
        {
            UnaryOperandNode expr = prn.Expression.Visit(this);

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