[antlr-interest] ANTLRWorks 1.1.7 reliability

Terence Parr parrt at cs.usfca.edu
Fri Jun 6 12:17:33 PDT 2008


try latest beta.
Ter
On Jun 6, 2008, at 2:45 AM, Artemus Ward wrote:

> I am new to all things ANTLR but I've been having pretty good success
> writing a grammar that recognizes my target language.  However I am a
> bit unconfident about why ANTLRWorks Interpreter treats certain inputs
> the way it does.
>
> I can post the grammer if it helps but perhaps the problem I've got is
> easily recognizable just from this description. I have the following
> rules:
>
> function_ref
> 	:	NAME '(' arg_list ')' | NAME '(' ')'  ;
>
> arg_list
> 	:	exp (',' exp)*  ;
>
> When I provide an input like X(1) and ask to ANTRLWorks to interpret
> it as a function_ref, it shows it is parsed as I expect.  But I have
> other rules, such as:
>
> exp	:	
> 		term (('||'|'+'|'-') term)* ;
>
> and term is in turn defined using other rules that eventually include
> a function_ref.  According to my grammar the input X(1) can also be
> parsed using this rule. But when I ask ANTLRWorks to do that, it shows
> a correct derivation except that the closing parenthesis seems not to
> be included in the derivation.
>
> So the question I have is whether this is a quirk of the display, or
> wether the input has been recognized without consuming all the tokens?
> The latter would of course mean I'm not understanding something.
>
> Art



More information about the antlr-interest mailing list