[antlr-interest] [3.0b4] StackOverflowError report

Robert Baruch autophile at zoominternet.net
Tue Oct 24 13:58:41 PDT 2006


Additional info, the equivalent grammar:

> start : r0 EOF ;
> r0 : N r0  ;
> r1 : N  ;

does not cause a stack overflow. So what's wrong with the r0 : r1 r0  
grammar?

--Rob


On Oct 24, 2006, at 1:15 PM, Robert Baruch wrote:

> Hi all,
>
> I have found a grammar which, although admittedly ridiculous,  
> nevertheless passes through ANTLR but throws a StackOverflowError  
> when parsing anything (in this case, the sentence "nn").
>
> Is there something wrong with the grammar? ANTLR?
>
> Thanks,
>
> --Rob
>
>
> grammar TestParser;
> options { superClass = GeneratedParser; }
> @parser::header {
>   import grammatotron.*; }
>
> start : r0 EOF ;
> r0 : r1 r0  ;
> r1 : N  ;
>
>
> N : 'n';
> V : 'v';
>
> Exception in thread "main" java.lang.StackOverflowError
> 	at org.antlr.runtime.BaseRecognizer.combineFollows 
> (BaseRecognizer.java:388)
> 	at  
> org.antlr.runtime.BaseRecognizer.computeContextSensitiveRuleFOLLOW 
> (BaseRecognizer.java:376)
> 	at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedElement 
> (BaseRecognizer.java:478)
> 	at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken 
> (BaseRecognizer.java:445)
> 	at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.java:98)
> 	at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:80)
> 	at TestParser.r1(TestParser.java:92)
> 	at TestParser.r0(TestParser.java:63)
> 	at TestParser.r0(TestParser.java:67)
> 	at TestParser.r0(TestParser.java:67)
> 	at TestParser.r0(TestParser.java:67)
> 	at TestParser.r0(TestParser.java:67)
> 	at TestParser.r0(TestParser.java:67)
> (etc)
>
> --Rob
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061024/607d2b91/attachment.html 


More information about the antlr-interest mailing list