In “normal” interpreted stratego code this

x* := [2, 3];
![1, x*, 4];
debug

outputs: [1,2,3,4]

While in the testing language, this

test z
x* := [2, 3];
![1, x*, 4]

results in: [1,[2,3],4]

So apparently, list variables aren’t handled (desugared?) properly by the interpreter.

Spoofax version: 0.6.1.4-r23707

Submitted by Tobi Vollebregt on 9 December 2011 at 17:07

On 9 December 2011 at 17:07 Tobi Vollebregt tagged testing

On 9 December 2011 at 17:07 Tobi Vollebregt tagged interpreter

On 20 December 2011 at 16:36 chris melman commented:

I think the test is correct, it shoudn’t be flattened


On 20 December 2011 at 17:15 Lennart Kats commented:

The testing language crudely implements interpretation with some calls to desugarings in the Stratego front-end. I guess one of them is missing. The flattening behavior of x* variables is what is expected here. It especially works wonders with concrete syntax.


On 20 December 2011 at 17:34 Guido Wachsmuth commented:

Is this behaviour triggered by the variable name, i.e. the *, or do I get this for any name? Seems to be an interesting feature for the code generation assignment.


On 20 December 2011 at 17:34 Guido Wachsmuth tagged lab

On 20 December 2011 at 17:38 chris melman commented:

wow that is a nice solution indeed for code generation


On 20 December 2011 at 17:44 Tobi Vollebregt commented:

Guido: it is triggered by the star.


On 20 December 2011 at 17:56 Lennart Kats commented:

It’s a bit of an esoteric feature though. Not a lot of people know it, and it may violate the principle of least surprise. It also doesn’t work as one may expect when used in matching. I wouldn’t teach this to the students :)

Log in to post comments