When using variables as LHS dynamic rules are broken.

In particular the order of strategies with a DR declaration matters if some of those declarations use a term variable as left hand side and some don’t. So essentially code may break randomly when just moving things around if there are any DRs in it that satisfy this condition.

For example the outcome of the following test programs differs depending on the order of the strategies in the file. It outputs 1 if s1 comes before s2 and 2 if s2 comes before s1.


module dr2
imports libstratego-lib
strategies
main = s1; s2; 1
s1 = rules(DR : 1 -> 1)
s2 = x := 1; rules(DR : x -> 2)

Output: 1


module dr2
imports libstratego-lib
strategies
main = s1; s2; 1
s2 = x := 1; rules(DR : x -> 2)
s1 = rules(DR : 1 -> 1)

Output: 2

The expected output for both programs would be 2.

Note that s1 adds a key 1{DR_DUMMY} to DR and s2 (using term variable as LHS) adds a key 1 to DR.

May be related to (some of) these issues:

Submitted by Tobi Vollebregt on 3 May 2011 at 12:37

Log in to post comments