[antlr-interest] ANTLRWorks 1.4.3 infinite loop during grammar check

Graham Mer gd.antlr at gmail.com
Thu Sep 8 03:23:11 PDT 2011


I just updated to ANTLRWorks 1.4.3, and a grammar that previously
verified correctly in the previous version of ANTLRWorks now never
completes verification or generation from within ANTLRWorks. The
following stack trace appears in the console, and the progress bar
never terminates:

Exception in thread "Thread-10" java.lang.StackOverflowError
	at java.util.HashMap$KeyIterator.<init>(HashMap.java:826)
	at java.util.HashMap$KeyIterator.<init>(HashMap.java:826)
	at java.util.HashMap.newKeyIterator(HashMap.java:840)
	at java.util.HashMap$KeySet.iterator(HashMap.java:874)
	at java.util.HashSet.iterator(HashSet.java:153)
	at java.util.AbstractCollection.addAll(AbstractCollection.java:303)
	at java.util.HashSet.<init>(HashSet.java:100)
	at org.antlr.analysis.SemanticContext.factorOr(SemanticContext.java:756)
	at org.antlr.analysis.SemanticContext.and(SemanticContext.java:609)
	at org.antlr.analysis.SemanticContext.and(SemanticContext.java:616)
	(the last line repeats hundreds of times)

I have tried increasing both the stack and heap for ANTLRWorks, no
improvement. Other grammars still pass, but this complex one
apparently causes ANTLRWorks to enter unterminated recursion. The
grammar still generates correctly with no errors from ANTLR 3.4 via
the ant task, so this appears to be limited to ANTLRWorks.

Is this a known issue?

Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
Mac OS X 10.6.8


More information about the antlr-interest mailing list