I'm trying to build an AST for if-then-else-endif like in BASIC. I'm trying

    prog:   ( ast {System.out.println($ast.tree.toStringTree());} )+ EOF;

    ast:   'if' condition a=thenstat b=elsestat 'endif' -> ^('if'
condition $a $b);

    thenstat: 'then'^ stat+;

    elsestat: 'else'^ stat+;

    stat:  'print'^ INT;

This gets me

    (if true (then (print 1) (print 2) (print 3)) (else (print 4)
(print 5) (print 6)))

However, I'd like to get

    (if true ((print 1) (print 2) (print 3)) ((print 4) (print 5) (print 6)))

How can I do it?

JH

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to