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

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Aug 25 05:54:41 PDT 2002


Hi Guys,

At last of end we have found time to work on our own SQL 92 grammar.
We can compile grammar without errors.
Problem only with some ambig warns.

For example, I get warn

> E:\antlr272a2\OBL\OBL_SQLGrammar.g:342:23: warning: nondeterminism upon
> E:\antlr272a2\OBL\OBL_SQLGrammar.g:342:23:     k==1:LPAREN
> E:\antlr272a2\OBL\OBL_SQLGrammar.g:342:23:     between alts 1 and 2 of block

on this rule:  (By the way, k = 1 for parser, for k = 2 the same problem)

--------------------------------------------------------------
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! )
    ;    
--------------------------------------------------------------

Is this rule incorrect ???

If remove ?  Then it compiles fine.

Also when I look into generated C++ Parser, for code of problematic line
I see that ANTLR test on tokens from MANY MANY other rules (that probably
call this one). 

I can understand why this is needed, just was surprised.
I did think that each rule is self-contained, but it seems generated code
depend on where and how a rule is called also.


-- 
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