[antlr-interest] Is this a bug of ANTLR3.1?
Jim Idle
jimi at temporal-wave.com
Thu Aug 28 08:17:10 PDT 2008
On Thu, 2008-08-28 at 18:40 +0800, Ronghui Yu wrote:
> I am using ANTLR3.1 for developing a SQL parser
>
> One of my main rule looks like this
>
> sql_statement:
> sql_statement_command (';')?
>
> But when generating parser codes from grammar file to C source, it
> always take a very long time and consume as much as 5G memory because
> of the optional semicolon
> Then in order to make the development easier, I make the semicolon a
> mandatory by removing the question mark, like this
>
> sql_statement:
> sql_statement_command ';'
>
> It does make the building faster and require much less memory.
This indicates that there is something wrong with the formulation of
your grammar - getting the terminators correct in SQL is not easy.
>
> But the problem now is, when parsing a statement without the
> semicolon, such as the following
>
> select * from tt
>
> ANTLR won't handle this but issue a signal 11
> His is the stack information when this happening, when all test has
> been matched and is going to match the last semicolon
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xb7370a09 in getMissingSymbol ()
> from /home/oracle/install/lib/libantlr3c.so
> (gdb) where
> #0 0xb7370a09 in getMissingSymbol ()
> from /home/oracle/install/lib/libantlr3c.so
> #1 0xb73701d0 in recoverFromMismatchedToken ()
> from /home/oracle/install/lib/libantlr3c.so
> #2 0xb736f7bb in match () from /home/oracle/install/lib/libantlr3c.so
Yes - this probably is a bug. TO give me a bettr chance of seeing what
is happening, can you rebuild the runtime with debug information
included (see configure --help) and run it via valgrind? It is probably
some boundary condition that I did not anticipate.
Jim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080828/37592b8a/attachment.html
More information about the antlr-interest
mailing list