Hi all,
I've been working, lately, at extracting the Java 1.7 grammar out of
the Java Language Specification (JLS), and resolving its conflicts.
I've learned a lot in the process (errors in the spec, differences
between the spec and the provided LL grammar in appendix, etc.). The
resulting annotated grammar is nice, but I have a problem.
The grammar takes over 3 hours for SableCC to compile on my system
using the following command:
$ java -d64 -Xms6144m -Xmx6144m -jar /Applications/sablecc-3.6/lib/sablecc.jar -d tmp java-1.7.sablecc
Observing memory usage, I can confirm that it takes more than 3 GB
of memory for SableCC not to run out of memory. I have 8 GB on my
system, so I was able to compile it.
Now, the problem is that, when I try to compile the generated
Parser.java file (291258 lines), I get:
$ javac org/sablecc/grammars/java_1_7/parser/Parser.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
at com.sun.tools.javac.util.Position$LineMapImpl.build(Position.java:139)
at com.sun.tools.javac.util.Position.makeLineMap(Position.java:63)
at com.sun.tools.javac.parser.Scanner.getLineMap(Scanner.java:1105)
at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:512)
at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)
at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:804)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
at com.sun.tools.javac.main.Main.compile(Main.java:353)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:69)
at com.sun.tools.javac.Main.main(Main.java:54)
Does any of you know a way to provide an option similar to "
java
-Xmx6144m" to
javac?
Thanks,
Etienne
--
Etienne Gagnon, Ph.D.
http://sablecc.org