[antlr-interest] [3.0b4] StackOverflowError report

Loring Craymer lgcraymer at yahoo.com
Tue Oct 24 16:17:20 PDT 2006


It's the grammar.  You cannot expect

r0:  r1 r0 ;

to terminate--it is looking for an infinite number of
r1's.

--Loring


--- Robert Baruch <autophile at zoominternet.net> 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
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the antlr-interest mailing list