[antlr-interest] java.tree.g #(QUESTION expr expr expr)
rustydstone
rustydstone at yahoo.com
Sat May 24 06:24:37 PDT 2003
Hi,
The following is slightly modified grammar from java.g and java.tree.g
conditionalExpression
: logicalOrExpression
( QUESTION^ conditionalExpression COLON! conditionalExpression )?
;
#(QUESTION q1:. q2:. q3:.)
When expression "(true || false)? 1 + 1 : 0 + 0" is processed the
following q1, q2 and q3 ASTs are received (printed using toStringList()):
q1 ( || true false ) ( + 1 1 ) ( + 0 0 )
q2 ( + 1 1 ) ( + 0 0 )
q3 ( + 0 0 )
Why does q1 contain q2 and q3? Why does q2 contain q3? I somehow
expected that the output would be like the following:
q1 ( || true false )
q2 ( + 1 1 )
q3 ( + 0 0 )
Any ideas? Thanks
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list