[antlr-interest] StackOverflow Error
Rob Hill
rob.hill at blueyonder.co.uk
Mon Dec 25 09:45:55 PST 2006
> Sent: 25 December 2006 16:55
LOL - Hey Ter, give it a rest mate ! Its Christmas! ;)
At 4.55, i was totally OD'd on xmas pudding and mince pies!
Don't tell me, Santa brought you a new PC, and you're just testing it
out.... hehehe
Merry Xmas!
/2ob
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> To: ANTLR List
> Subject: Re: [antlr-interest] StackOverflow Error
>
> Hi. You've made an infinite loop with your tail recursion in those
> aggr. and remaining rules.
> Ter
> On Dec 25, 2006, at 2:58 AM, Debabrata Pani wrote:
>
> > hi ,
> > I have a grammar and i have generated parsers using ANTLR.
> > for smaller files the program runs without error,
> > but for even reasonably medium sized ones, 70kBytes, the parser
> > throws a
> > STACK OVERFLOW exception
> > The grammar was for parsing Open Financial Exchange files, which is
> > based on SGML.
> >
> > Sample OFX file:
> >
> > OFXHEADER:100
> > DATA:OFXSGML
> > VERSION:102
> > SECURITY:NONE
> > ENCODING:USASCII
> > CHARSET:1252
> > COMPRESSION:NONE
> > OLDFILEUID:NONE
> > NEWFILEUID:NONE
> >
> > <OFX>
> > <SIGNONMSGSRSV1>
> > <SONRS>
> > <STATUS>
> > <CODE>0
> > <SEVERITY>INFO
> > </STATUS>
> > <DTSERVER>20051124163122
> > <LANGUAGE>ENG
> > </SONRS>
> > </SIGNONMSGSRSV1>
> > <CREDITCARDMSGSRSV1>
> > <CCSTMTTRNRS>
> > <TRNUID>0
> > <STATUS>
> > <CODE>0
> > <SEVERITY>INFO
> > </STATUS>
> > <CCSTMTRS>
> > <CURDEF>USD
> > <CCACCTFROM>
> > <ACCTID>XXXXXXXXXXXXXXXX
> > </CCACCTFROM>
> > <BANKTRANLIST>
> > <DTSTART>20051003120000
> > <DTEND>20051025120000
> > <STMTTRN>
> > <TRNTYPE>DEBIT
> > <DTPOSTED>20051002180000
> > <TRNAMT>-35.06
> > <FITID>3013062760001
> > <SIC>5499
> > <NAME>Random graphs
> > </STMTTRN>
> > ...
> >
> > The grammars is :
> >
> > class OfxParser extends Parser;
> > options
> > {
> > k=2
> > }
> > ofx_entity : ofx_header NEWLINE ofx_aggregate EOF
> > ;
> >
> > ofx_header: (n:NAME COLON m:NAME)NEWLINE ofx_header
> >
> > |
> >
> > ;
> >
> > ofx_aggregate : tag_open (WS|NEWLINE)* remaining
> > | tag_closed (WS|NEWLINE)* ofx_aggregate
> >
> > |
> > ;
> >
> > remaining : ofx_aggregate
> > | element (NEWLINE)* ofx_aggregate
> >
> > ;
> > tag_open : LT n:NAME GT
> >
> > ;
> >
> > tag_closed : LT FSLASH n:NAME GT
> >
> > ;
> >
> >
> > element : (n:NAME (WS|COLON|FSLASH)*)+
> >
> > ;
> >
> > The error thrown was:
> >
> > java.lang.StackOverflowError
> > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
> > (Unknown Source)
> > at java.lang.reflect.Constructor.newInstance(Unknown Source)
> > at java.lang.Class.newInstance0(Unknown Source)
> > at java.lang.Class.newInstance (Unknown Source)
> > at antlr.CharScanner.makeToken(CharScanner.java:175)
> > at com.project.finance.importer.ofx.OFXLexer.mLT(OFXLexer.java:
> > 379)
> > at com.project.finance.importer.ofx.OFXLexer.nextToken
> > (OFXLexer.java :92)
> > at antlr.TokenBuffer.fill(TokenBuffer.java:69)
> > at antlr.TokenBuffer.LA(TokenBuffer.java:80)
> > at antlr.LLkParser.LA(LLkParser.java:52)
> > at com.project.finance.importer.ofx.OfxParser.element
> > (OfxParser.java :304)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:239)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:234)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:192)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:253)
> > at com.project.finance.importer.ofx.OfxParser.ofx_aggregate
> > (OfxParser.java:166)
> > at com.project.finance.importer.ofx.OfxParser.remaining
> > (OfxParser.java:234)
> > ....
More information about the antlr-interest
mailing list