[antlr-interest] Is this a bug of ANTLR3.1?

Ronghui Yu Ronghui.Yu at SierraAtlantic.com
Thu Aug 28 03:40:14 PDT 2008


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.

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

In my opinion, ANTLR should initialize an exception that can be processed by his own way, not issue this signal
Anyone has any ideas of suggestions on this?
Thanks a lot


==============================
Regards,
Ronghui Yu
Sierra Atlantic

__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation." 
________________________________________________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080828/a0aa574f/attachment.html 


More information about the antlr-interest mailing list