我正在尝试使用 Antlr 3 编译此语法文件(用于 Creole wiki 标记),但只是使用 Antlr 工具(C# 版本)出现内存泄漏,并且 Java 版本的堆空间不足:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.util.Arrays.copyOf(Unknown Source)
at java.util.ArrayList.grow(Unknown Source)
at java.util.ArrayList.ensureCapacityInternal(Unknown Source)
at java.util.ArrayList.add(Unknown Source)
at org.antlr.misc.OrderedHashSet.add(OrderedHashSet.java:67)
at org.antlr.analysis.DFAState.addNFAConfiguration(DFAState.java:229)
at org.antlr.analysis.NFAToDFAConverter.closure(NFAToDFAConverter.java:632)
at org.antlr.analysis.NFAToDFAConverter.closure(NFAToDFAConverter.java:708)
at org.antlr.analysis.NFAToDFAConverter.closure(NFAToDFAConverter.java:477)
at org.antlr.analysis.NFAToDFAConverter.findNewDFAStatesAndAddDFATransitions(NFAToDFAConverter.java:296)
at org.antlr.analysis.NFAToDFAConverter.convert(NFAToDFAConverter.java:110)
at org.antlr.analysis.DFA.<init>(DFA.java:237)
at org.antlr.tool.Grammar.createLookaheadDFA(Grammar.java:1355)
at org.antlr.tool.Grammar.createLookaheadDFAs(Grammar.java:1119)
at org.antlr.tool.Grammar.createLookaheadDFAs(Grammar.java:1069)
at org.antlr.codegen.Target.performGrammarAnalysis(Target.java:118)
at org.antlr.codegen.JavaTarget.performGrammarAnalysis(JavaTarget.java:54)
at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:286)
at org.antlr.Tool.generateRecognizer(Tool.java:696)
at org.antlr.Tool.process(Tool.java:509)
at org.antlr.Tool.main(Tool.java:98)
有什么方法可以编译语法吗?