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

Sergey Bogdanov serge.bogdanov at intel.com
Fri Jul 23 05:04:25 PDT 2004


--- In antlr-interest at yahoogroups.com, Ruslan Zasukhin 
<sunshine at p...> wrote:
> On 7/23/04 1:34 PM, "Pete Forman" <pete.forman at w...> wrote:
> 
> > At 2004-07-23 12:39 +0300, Ruslan Zasukhin wrote:
> >> So lexer returns ID,
> >> 
> >> But we add one more rule to Parser
> >> 
> >>   identifier : ..............
> > 
> > Explicitly, the lexer returns IDENTIFIER, LEFT, RIGHT, FULL, 
OUTER,...
> > 
> > One identifier rule might not be enough.  The set of keywords 
that are
> > allowed to be table names may not be the same as those for 
function
> > names and so on.
> 
> I see your points,
> 
> But in general problem is complex.
> By SQL92 standard 
> 
>     ANY KEYWORD can be used as name of table or field or function.
> 
> It looks your adivce can resolve only that 2 examples which I have 
show.
> But geenral task is more hard.
> 
> Any ideas now ?
> 

Another idea you could try is to have your own token type that could 
return different token values depending on a state of the parser. 
The state of the parser could be changed when entering a rule or an 
alternative. But it could be difficult to implemet in some grammars. 

btw, It might be interesting to implement multy-value tokens in 
antlr, where the latter could match a type against a token, not vice 
versa.



 
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