[antlr-interest] Re: SQL grammar, help on ambig warns

Terence Parr parrt at jguru.com
Fri Aug 30 15:57:12 PDT 2002


On Friday, August 30, 2002, at 02:19  PM, Ruslan Zasukhin wrote:

> on 8/26/02 23:59, lgcraymer at lgc at mail1.jpl.nasa.gov wrote:
>
>>> I just do all my best to keep grammar k=1 and avoid syntax
>> predicates to get
>>
>> The k value affects ANTLR grammar analysis much more than it affects
>> generated code.  Setting k=50, for example, can cause the analysis to
>> take "forever" to generate code from an input grammar, but the
>> generated code does not change (if k is already large enough to remove
>> ambiguities).  In your case, k=2 may be a good choice:  "LPAREN
>> unsigned_integer" may not be ambiguous.
>
> I have just only read this words.
>
> This is totally new info for me!
>
> It must be added to docs of ANTLR

The information is around and I seem to repeat this concept a lot on 
the list that you can set k to what you want but ANTLR uses the minimum 
needed <= k.  JavaCC for example forces you to specify the lookahead to 
use per decision (if k>1 I believe); antlr does some groovy analysis 
etc... to relieve you of this.  Most tools force k=1 since they can't 
do lookahead computation at all let alone do the nondeterminism 
analysis. :)

Ter


 

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



More information about the antlr-interest mailing list