[antlr-interest] Question
Jim Idle
jimi at temporal-wave.com
Tue Apr 29 09:23:03 PDT 2008
When you debug are you selecting the start rule 'term' - I bet you are starting with atom. If interpretting, probaly th same things!
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Bill Andersen
> Sent: Tuesday, April 29, 2008 9:21 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Question
>
> 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