[antlr-interest] Re: Very weird SQL parser failures - look-ahead? - FIXED

anatoli_krassavine toly at intellidos.com
Tue Jun 1 10:49:56 PDT 2004


Hello Monty,

Great thanks to you and Bharath for comments - it pushed me in 
correct direction. There was a stupid grammar mistake which only 
showed when I used -traceParser.

I will definitely take a look at NIST SQL-92 test suite as you 
adviced.

Since you just finished a SQL parser of your own, could I ask a quick 
question. Is there a simple way in Antlr to specify pairs of optional 
matching parenthesis (I mean apart from brute-force when you mark 
them explicitly)?

Sincerely,
   Toly

--- In antlr-interest at yahoogroups.com, Monty Zukowski <monty at c...> 
wrote:
> Run antlr.Tool with -traceParser, that may help you figure out 
where it 
> is going wrong.
> 
> Also, I just finished a SQL parser on contract.  I recommend the 
NIST 
> SQL-92 test suite to ferret out grammatical problems such as these.
> 
> I am also available by the hour to debug things like this.  
> Unfortunately I don't have so much "free" time to solve these 
problems 
> for fun any more.
> 
> Monty Zukowski
> 
> ANTLR & Java Consultant -- http://www.codetransform.com
> ANSI C/GCC transformation toolkit -- 
> http://www.codetransform.com/gcc.html
> Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
> 
> 
> 
> 
> On Jun 1, 2004, at 10:20 AM, anatoli_krassavine wrote:
> 
> > Hello Bharath,
> >
> > This is /grammar/ORACLE-7-SQL from ANTLR website virtually 
verbatium.
> >
> > I cannot see anything in the grammar which would have caused such
> > behaviour. It also appears specific to
> >
> > select ....... where ... in (select .....)
> >
> > statements
> >
> > I honestly tried to find what is wrong, but cannot see it.
> >
> > Cheers,
> >  Toly
> >
> > --- In antlr-interest at yahoogroups.com, "Bharath Sundararaman"
> > <bharath at s...> wrote:
> >>
> >> Hi,
> >>
> >> Where is the grammar for the statement? If you had a grammar rule
> > which
> >> expects a CLOSE_PAREN right after the IDENTIFIER (abc), it should
> > give the
> >> error. It would be nice if you copy-paste the rule for this SQL
> > statement.
> >>
> >> Bharath.
> >> ~Give me the tool and I shall move the earth~
> >>
> >> -----Original Message-----
> >> From: anatoli_krassavine [mailto:toly at i...]
> >> Sent: Tuesday, June 01, 2004 10:47 AM
> >> To: antlr-interest at yahoogroups.com
> >> Subject: [antlr-interest] Very weird SQL parser failures - look-
> > ahead?
> >>
> >>
> >>   Hello,
> >>
> >> I tried to use Oracle 7 SQL grammar in anger. It works great for
> > very
> >> complex SQL statements, but I suddenly stumbled on an unexpected
> >> issues with what I consider to be a very simple SQL. Could 
someone
> >> please advice.
> >>
> >> The following statement fails with
> >> Exception in thread "main" line 10:2: expecting CLOSE_PAREN,
> >> found 'null'
> >>
> >> ------------
> >> SELECT *
> >> FROM
> >>     c.abcd
> >> WHERE
> >>     cr.no IN
> >> (
> >> SELECT cr.no FROM c.cr cr
> >> union
> >> SELECT a FROM abc where a=b
> >> )
> >> ------------
> >> On the other hand this works fine (note that "where a=b" was
> > removed)
> >>
> >> SELECT *
> >> FROM
> >>     c.abcd
> >> WHERE
> >>     cr.no IN
> >> (
> >> SELECT cr.no FROM c.cr cr
> >> union
> >> SELECT a FROM abc
> >> )
> >> ------------
> >>
> >> AFAICC, it is not a problem with syntax, but a problem with a 
look-
> > ahead,
> >> but I do not understand how to fix this.
> >>
> >> Any help or pointing in the right direction will be greatly
> >> appreciated.
> >>
> >> Details:
> >> Oracle 7 SQL grammar from  /grammar/ORACLE-7-SQL
> >> No changes, conventional lexer/parser generated
> >>
> >>
> >>
> >>
> >>
> >> Yahoo! Groups Links
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >



 
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