[antlr-interest] Unexpected ANTLR action
Rich
rjseagraves at gmail.com
Thu May 25 13:46:41 PDT 2006
According to the "ANTLR Tree Construction" chapter of the antlr manual
"If no suffixes at all are specified in a grammar, then a Parser will
construct a linked-list of the tokens." However, I'm not getting the
behavior I was expecting. Consider the following grammar (grammar
simplified to protect the irrelevant):
class SimpleParser extends Parser;
options {
buildAST = true;
}
expr
: id_expr ((DOT)? id_expr)*
;
id_expr
: ID
;
When I test this parser with input "a b c d", I was expecting to get
the list (a b c d). Instead, I just get "a". What gives? Thanks
alot everybody.
-Rich
More information about the antlr-interest
mailing list