metaborg / spoofax

Spoofax runtime
Apache License 2.0
124 stars 23 forks source link

StackOverflow during Maven Build #93

Open evonox opened 1 week ago

evonox commented 1 week ago

I am a complete newbie to Spoofax. However, if you try this SDF3 grammar, the build process terminates with StackOverflow. The steps I take is just mvn clean and mvn compile.

module Literals

imports
    Common

context-free sorts
    LiteralValue 
    ComplexLiteral 
    // LiteralList 
    PrimitiveLiteral
    LiteralBoolean
    // LiteralNumeric
    LiteralNull
    // LiteralString
    // ListElementItems

context-free syntax

    // LiteralValue = ComplexLiteral
    LiteralValue = PrimitiveLiteral

    // ComplexLiteral = LiteralList
    // LiteralList.LiteralList = < "[" elements:{item:LiteralValue ',' }* "]" >

    PrimitiveLiteral = LiteralNull
    PrimitiveLiteral = LiteralBoolean
    // PrimitiveLiteral = LiteralString
    // PrimitiveLiteral = LiteralNumeric

    LiteralNull.LiteralNull = 'null'
    LiteralBoolean.LiteralBoolean = [ value:('true' | 'false') ]
    // LiteralString = STRING
    // LiteralNumeric = NUMERIC

If you comment out the non-existent ComplexLiteral from context-free sorts, then the build passes.

evonox commented 1 week ago

OUTPUT LOG

 at org.strategoxt.strj.all_consnil_1_0.invoke (all_consnil_1_0.java:49)
    at org.strategoxt.strj.t_2755.invoke (t_2755.java:27)
    at org.strategoxt.strj.all_consnil_1_0.invoke (all_consnil_1_0.java:49)
    at org.strategoxt.strj.t_2755.invoke (t_2755.java:27)
    at org.strategoxt.lang.SRTS_all.invoke (SRTS_all.java:30)
    at org.strategoxt.strj.all_consnil_1_0.invoke (all_consnil_1_0.java:62)
    at org.strategoxt.strj.t_2755.invoke (t_2755.java:27)
[INFO] Store get cache hit rate: 0.0%
[INFO] Tree nodes cache hit rate: 0.0%
[INFO] Exodus log cache hit rate: 0.0%
[ERROR] Exception thrown during build
org.metaborg.core.MetaborgException: build.pluto.builder.RequiredBuilderFailed: Required builder failed. Error occurred in build step "Compile Stratego code": java.lang.RuntimeException: java.lang.StackOverflowError
    at org.metaborg.spoofax.meta.core.build.LanguageSpecBuilder.compile (LanguageSpecBuilder.java:177)
    at org.metaborg.spoofax.maven.plugin.mojo.language.CompileMojo.execute (CompileMojo.java:34)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: build.pluto.builder.RequiredBuilderFailed: Required builder failed. Error occurred in build step "Compile Stratego code": java.lang.RuntimeException: java.lang.StackOverflowError
Apanatshka commented 1 week ago

Hi @evonox, sorry to see you run into this. This is most likely caused by a part of the toolchain written in Stratego, which uses a bit more stack space than the usual Java program. Try following the instructions on the website on Maven memory allocation.