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

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Aug 25 23:21:01 PDT 2002


on 8/26/02 7:59, lgcraymer at lgc at mail1.jpl.nasa.gov wrote:

> Ruslan--
> 
> One likely scenario is that somewhere in your grammar you have a rule
> which follows character_string_type with "LPAREN" and ANTLR can't tell
> whether to assign an LPAREN to that or to "character_string_type" in
> the optional subrule.  You may need a syntactic predicate to
> disambiguate ...

As I understand using of syntax predicate is THE ONLY way to run around
this?

I just do all my best to keep grammar k=1 and avoid syntax predicates to get
it as fat as possible. I need this SQL parser for real-life DBMS.

If speak about syntax predicate...
How it must looks to still have optional branch.
I think about adding empty alternative.
Is this correct? 

character_string_type
     :    ( "character" | "char" )
             ( "varying" LPAREN! unsigned_integer RPAREN!
             |     
                (( LPAREN! unsigned_integer RPAREN! ) =>
                     ( LPAREN! unsigned_integer RPAREN! )
                | /* nothing */
                )
            )      

Just for interest. I assume that it is possible redo some grammar rules so
it will be possible to avoid syntax predicate, yes? Because for YACC it is
possible.


>> --------------------------------------------------------------
>> character_string_type
>>     :    ( "character" | "char" )
>>             (    "varying" LPAREN! unsigned_integer RPAREN!
>>             |     ( LPAREN! unsigned_integer RPAREN! )?     <<<<<<
> here
>>             )
>>     |    ("varchar" | "string")
>>             (     LPAREN! unsigned_integer
>>                      (COMMA! character_string_literal)? RPAREN! )
>>     ;    
>> --------------------------------------------------------------

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net
-------------------------------------------------------------


 

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



More information about the antlr-interest mailing list