[antlr-interest] ANTLR meta-syntax question

Ric Klaren klaren at cs.utwente.nl
Mon May 13 06:25:17 PDT 2002


Hi,

On Sun, May 12, 2002 at 11:29:46PM -0500, Brian Smith wrote:
> I am new to ANTLR. I have found that it seems fairly straightforward to 
> convert a BNF grammar to work with ANTLR. But, I am having trouble 
> understanding why ANTLR insists on me using parentheses when they seem 
> redundant to me. For example, I have a rule:
> 
> A    :    B+;
> 
> I expect to match one or more B's. But, ANTLR complains unless I rewrite 
> the rule as:
> 
> A    :   (B)+;
> 
> To me, the parentheses are not necessary. Am I doing something wrong? Is 
> there a particular reason that ANTLR requires the parentheses? I prefer 
> to use parentheses only for grouping.

This is just as it's defined in antlr's syntax. The parentheses belong to
the construct.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     Innovation makes enemies of all those who prospered under the old
   regime, and only lukewarm support is forthcoming from those who would
               prosper under the new. --- Niccolò Machiavelli


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list