Oracle grammar ambiguities and conflicts

Mark Thiehatten <mark.thiehatten@bibit.com>
12 Jan 2006 12:15:57 -0500

          From comp.compilers

Related articles
SQL grammar problem with Visual Parse++ junk@junk.com (John) (2001-07-23)
Oracle grammar ambiguities and conflicts mattblackmon@hotmail.com (matt blackmon) (2006-01-09)
Re: Oracle grammar ambiguities and conflicts grosch@cocolab.de (Josef Grosch) (2006-01-12)
Re: Oracle grammar ambiguities and conflicts derek@knosof.co.uk (Derek M. Jones) (2006-01-12)
Re: Oracle grammar ambiguities and conflicts cfc@shell01.TheWorld.com (Chris F Clark) (2006-01-12)
Re: Oracle grammar ambiguities and conflicts DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-01-12)
Re: Oracle grammar ambiguities and conflicts drikosv@otenet.gr (Evangelos Drikos) (2006-01-12)
Oracle grammar ambiguities and conflicts mark.thiehatten@bibit.com (Mark Thiehatten) (2006-01-12)
Re: Oracle grammar ambiguities and conflicts cfc@shell01.TheWorld.com (Chris F Clark) (2006-01-17)
Re: Oracle grammar ambiguities and conflicts mattblackmon@hotmail.com (Matt Blackmon) (2006-01-17)
Re: Oracle grammar ambiguities and conflicts david@tribble.com (David R Tribble) (2006-01-17)
Re: Oracle grammar ambiguities and conflicts parsersinc@earthlink.net (SLK Parsers) (2006-01-19)
Re: Oracle grammar ambiguities and conflicts parsersinc@earthlink.net (SLK Parsers) (2006-01-19)
Re: Oracle grammar ambiguities and conflicts parsersinc@earthlink.net (SLK Parsers) (2006-01-20)
| List of all articles for this month |
From: Mark Thiehatten <mark.thiehatten@bibit.com>
Newsgroups: comp.compilers
Date: 12 Jan 2006 12:15:57 -0500
Organization: Compilers Central
References: 01-07-118
Keywords: parse, SQL
Posted-Date: 12 Jan 2006 12:15:57 EST

On dealing with non-reserved words as keywords, our moderator wrote:


>>[That's a famous problem. There's a variety of less than fabulous
>>solutions, hacks in the lexer to guess when to return a keyword and
>>when to return a symbol, parser backup if it gags on a keyword, or
>>bushy parsers that put all of the allowed keywords into the grammar
>>in places where they can be used as symbols. -John]




> 1) "parser backup if it gags on a keyword" -- not feasible in
> bison/flex (to my knowledge), and most tools capable of producing backups
> use exception based processing, which results in unacceptable performance
> for my task.


I have actually used a solution that does precisely this. The "trick" is
that you essentially need to copy the parts of the bison skeleton that do
the reduce-actions to find out if your keyword is applicable. (you need to
check acceptable tokens to shift for every state that is reachable without
shifting a token to the stack) This can be done as a sort of intermediate
stage between your lexer and parser.


Unfortunately for you I don't have the code anymore. Another poster to
this newsgroup gave to me, and I don't recall many details about it,
except that it worked well but was seriously hard to read (but then again,
it was most likely copied directly from the seleton file bison uses, and
that is, not optimized for human readability)


The thread about this can be found here: (no code though)
http://compilers.iecc.com/comparch/article/96-08-058




--
Mark Thiehatten


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.