Parser grammar improvements #2

Closed
wants to merge 9 commits into
from

Conversation

Projects
None yet
2 participants
@alexbiehl
Contributor

alexbiehl commented Apr 6, 2013

Hey Pekka,

please take a look at my changes and merge them if you think they're okay! Just tell me if something is wrong.

Alex

@penberg

This comment has been minimized.

Show comment Hide comment
@penberg

penberg Apr 6, 2013

Owner

Interestingly enough, I'm seeing this when I do "mvn package":

warning(24):  template error: context [/outputFile /lexer /cyclicDFA] 14:3 no such property or can't access: org.antlr.analysis.DFA.javaCompressedTransition
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: org.antlr.analysis.DFA.javaCompressedTransition
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:106)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:64)
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeIterator(Interpreter.java:733)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:708)
    at org.stringtemplate.v4.Interpreter.writeObjectWithOptions(Interpreter.java:665)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:292)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.ST.write(ST.java:415)
    at org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1296)
    at org.antlr.codegen.Target.genRecognizerFile(Target.java:98)
    at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:459)
    at org.antlr.Tool.generateRecognizer(Tool.java:696)
    at org.antlr.Tool.process(Tool.java:565)
    at org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:382)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:60)
    ... 41 more
Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.<init>(ArrayList.java:112)
    at org.antlr.analysis.DFA.getRunLengthEncoding(DFA.java:361)
    at org.antlr.analysis.DFA.getJavaCompressedTransition(DFA.java:337)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:60)
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeIterator(Interpreter.java:733)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:708)
    at org.stringtemplate.v4.Interpreter.writeObjectWithOptions(Interpreter.java:665)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:292)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.ST.write(ST.java:415)
    at org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1296)
    at org.antlr.codegen.Target.genRecognizerFile(Target.java:98)
    at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:459)
    at org.antlr.Tool.generateRecognizer(Tool.java:696)
    at org.antlr.Tool.process(Tool.java:565)
    at org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:382)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

Does it ring a bell? Maybe we need to configure larger heap size for the Maven plugin?

Owner

penberg commented Apr 6, 2013

Interestingly enough, I'm seeing this when I do "mvn package":

warning(24):  template error: context [/outputFile /lexer /cyclicDFA] 14:3 no such property or can't access: org.antlr.analysis.DFA.javaCompressedTransition
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: org.antlr.analysis.DFA.javaCompressedTransition
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:106)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:64)
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeIterator(Interpreter.java:733)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:708)
    at org.stringtemplate.v4.Interpreter.writeObjectWithOptions(Interpreter.java:665)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:292)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.ST.write(ST.java:415)
    at org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1296)
    at org.antlr.codegen.Target.genRecognizerFile(Target.java:98)
    at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:459)
    at org.antlr.Tool.generateRecognizer(Tool.java:696)
    at org.antlr.Tool.process(Tool.java:565)
    at org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:382)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:60)
    ... 41 more
Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.<init>(ArrayList.java:112)
    at org.antlr.analysis.DFA.getRunLengthEncoding(DFA.java:361)
    at org.antlr.analysis.DFA.getJavaCompressedTransition(DFA.java:337)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:60)
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeIterator(Interpreter.java:733)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:708)
    at org.stringtemplate.v4.Interpreter.writeObjectWithOptions(Interpreter.java:665)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:292)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
    at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
    at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
    at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
    at org.stringtemplate.v4.ST.write(ST.java:415)
    at org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1296)
    at org.antlr.codegen.Target.genRecognizerFile(Target.java:98)
    at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:459)
    at org.antlr.Tool.generateRecognizer(Tool.java:696)
    at org.antlr.Tool.process(Tool.java:565)
    at org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:382)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

Does it ring a bell? Maybe we need to configure larger heap size for the Maven plugin?

@alexbiehl

This comment has been minimized.

Show comment Hide comment
@alexbiehl

alexbiehl Apr 6, 2013

Contributor

Looks like it. Had the same issues on my laptop and increasing heap size helped. And since travis can build alright it seems plausible.

Contributor

alexbiehl commented Apr 6, 2013

Looks like it. Had the same issues on my laptop and increasing heap size helped. And since travis can build alright it seems plausible.

@penberg

This comment has been minimized.

Show comment Hide comment
@penberg

penberg Apr 6, 2013

Owner

Okay, bumping up heap size helps but then I'm getting this in the REPL:

localhost:fjord penberg$ ./bin/fji 
Fjord (Java HotSpot(TM) 64-Bit Server VM 1.6.0_43-b01-447-10M4203) [Mac OS X-x86_64]

For help type #help
> let x = 1

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2760)
    at java.util.Arrays.copyOf(Arrays.java:2734)
    at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
    at java.util.ArrayList.add(ArrayList.java:351)
    at fjord.compiler.FsharpParser.moduleElems(FsharpParser.java:1758)
    at fjord.compiler.FsharpParser.scriptFragment(FsharpParser.java:800)
    at fjord.compiler.Compiler.parse(Compiler.java:20)
    at fjord.Main.eval(Main.java:36)
    at fjord.Main.main(Main.java:29)

I think there's something fishy going on with the grammar that's causing this...

Owner

penberg commented Apr 6, 2013

Okay, bumping up heap size helps but then I'm getting this in the REPL:

localhost:fjord penberg$ ./bin/fji 
Fjord (Java HotSpot(TM) 64-Bit Server VM 1.6.0_43-b01-447-10M4203) [Mac OS X-x86_64]

For help type #help
> let x = 1

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2760)
    at java.util.Arrays.copyOf(Arrays.java:2734)
    at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
    at java.util.ArrayList.add(ArrayList.java:351)
    at fjord.compiler.FsharpParser.moduleElems(FsharpParser.java:1758)
    at fjord.compiler.FsharpParser.scriptFragment(FsharpParser.java:800)
    at fjord.compiler.Compiler.parse(Compiler.java:20)
    at fjord.Main.eval(Main.java:36)
    at fjord.Main.main(Main.java:29)

I think there's something fishy going on with the grammar that's causing this...

@penberg

This comment has been minimized.

Show comment Hide comment
@penberg

penberg Apr 8, 2013

Owner

I'm closing this.

Owner

penberg commented Apr 8, 2013

I'm closing this.

@penberg penberg closed this Apr 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment