[antlr-interest] SQL grammar, keywords that can be identifiers

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jul 22 12:33:49 PDT 2004


Hi All,

It seems in the past we have discuss this, but I want ask once again.

We have SQL grammar.

We have for example the next rule

join_type
    :    ("left" | "right" | "full" ) ( "outer"! )?


But SQL grammar still must accept the next query

    WHERE left(fld,5) = "Peter"
          ^^^^^  


As you see problem is that 'left' is keyword.
ANTLR mark it as token in Lexer.

So our function left() simple return error.

--------------
Another example of problem. SQL by standard allow to use field and table
names as key words.

    SELECT *
    FROM references
    
Here "references" is name of table.
But SQL also have key word 'references'.
So we get conflict.


-------------
1) Can anybody explain to __as child__

    how this can be resolved in ANTLR ?


2) does exists in ANTLR at least one example which demonstrate such hard
grammars?  If no then, Terrence, may be there is sense to add one?
May be some mini-SQL ?

Thank you in advance.


-- 
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 go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list