Spoofax 2.1.0
Related to http://yellowgrass.org/issue/Spoofax/163

A large expression such as val = 0 OR val = 1 OR val = 2 .... OR val = 10000 generates the following exception (max JVM stack size = 16MB):

java.lang.StackOverflowError
	at pgql_lang.trans.lifted2145.invoke(lifted2145.java:38)
	at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60)
	at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
	at pgql_lang.trans.origin_track_forced_1_0.invoke(origin_track_forced_1_0.java:36)
	at pgql_lang.trans.lifted2144.invoke(lifted2144.java:38)
	at org.strategoxt.stratego_lib.preserve_annos_1_0.invoke(preserve_annos_1_0.java:29)
	at pgql_lang.trans.nabl_collect_1_4.invoke(nabl_collect_1_4.java:149)
	at pgql_lang.trans.nabl_siblings_0_4.invoke(nabl_siblings_0_4.java:55)
	at pgql_lang.trans.lifted2145.invoke(lifted2145.java:44)
	at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60)
	at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
	at pgql_lang.trans.origin_track_forced_1_0.invoke(origin_track_forced_1_0.java:36)
	at pgql_lang.trans.lifted2144.invoke(lifted2144.java:38)
	at org.strategoxt.stratego_lib.preserve_annos_1_0.invoke(preserve_annos_1_0.java:29)
	at pgql_lang.trans.nabl_collect_1_4.invoke(nabl_collect_1_4.java:149)
	at pgql_lang.trans.nabl_siblings_0_4.invoke(nabl_siblings_0_4.java:55)
Submitted by Oskar van Rest on 5 April 2017 at 02:27

On 10 April 2017 at 11:42 Gabriël Konat tagged performance

On 10 April 2017 at 11:42 Gabriël Konat tagged stack

On 10 April 2017 at 11:44 Gabriël Konat commented:

This is due to the recursive nature of Stratego, and in particular the task and fact collection of NaBL. The only thing you can do is increase the stack size.


On 12 April 2017 at 01:30 Oskar van Rest commented:

I think you’re right that this is not a Spoofax issue since you can’t really implement an expression tree without using recursion.
Even Java’s compiler throws an exception if you make the expression long enough:

java.lang.StackOverflowError
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.tree.TreeScanner.visitBinary(TreeScanner.java:244)
        at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1785)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.tree.TreeScanner.visitBinary(TreeScanner.java:244)
        at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1785)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.tree.TreeScanner.visitBinary(TreeScanner.java:244)
        at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1785)

Closing this issue but keeping issue http://yellowgrass.org/issue/Spoofax/163 open since for parsing of literals in SDF or doing String manipulation in Stratego you really want to avoid using recursion (same for operating on general lists).


On 12 April 2017 at 01:30 Oskar van Rest closed this issue.

On 12 April 2017 at 06:37 Guido Wachsmuth commented:

For string manipulation, you probably want Java methods manipulating strings instead of Stratego strategies manipulating ATerm lists of characters.

Log in to post comments