[antlr-interest] Question
Bill Andersen
andersen at ontologyworks.com
Tue Apr 29 09:20:38 PDT 2008
Folks,
I have a grammar (relevant snippet below) with which I'm having a
parsing problem. (I'm using ANTLR 3.1 in a beta release of ANTLRWorks
FWIW)
term
: NAME
| LP term+ RP
;
atom
: LP term+ RP
;
LP
: '('
;
RP
: ')'
;
NAME
: ('a'..'z')+
;
WS
: (' '|'\t'|'\n'|'\r') {$channel=HIDDEN;}
;
Attempts to parse "( foo )" in ANTLRWorks' interpreter as a 'term'
fails. while parsing "( ( foo ) )" as an 'atom' succeeds (i.e. I'm
seeing the correct parse trees). Note that the former 'term' is
embedded in the latter 'atom'. Am I making an obvious mistake? Any
help appreciated.
.bill
More information about the antlr-interest
mailing list