<div dir="ltr"><div dir="ltr" style="font-size:12.8px">What language is that? What does rec mean? L4 leads to the line "while #3 goto L5 goto L2". Does that mean go to L5 and then go to L2? If so, will L2 ever be gotten to, given that L5 leads back to L4?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 1, 2016 at 10:59 AM, Anakreontas <span dir="ltr"><<a href="mailto:anakreonmejdi@gmail.com" target="_blank">anakreonmejdi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to implement a program transformation with Hoopl. The<br>transformation replaces a particular statement with variable<br>declarations provided that the variables have not been previously<br>declared. A map keeps track of declared variables where the map keys<br>store variable names.<br><br>The transformation works only for programs without loops. In the<br>program below, it should replace line<br>2 rec #3 INxt B37H00G<br>with<br>1 Global Field B37H00G<br>2 Global Array B37HO3R<br>3 rec #3 INxt B37H00G<br>but it doesn't.<br><br>=== Example graph ==<br>0 goto L4<br>1 L4:<br>2 rec #3 INxt B37H00G<br>3 while #3 goto L5 goto L2<br>4 L5:<br>5 Global Field VSTF01a<br>6 goto L4<br>7 L2:<br><br>I think the reason it fails is because there are two paths leading to<br>L4, one from the program start (line 0) and a second when the loop<br>repeats from line 6. In the first case the transformation produces the<br>substitution graph since the two variables are not in the map. In the<br>analysis of the second path however, the variables are in the name space so<br>the rewrite function returns Nothing. In the end, the second<br>transformation result is preserved (i.e. Nothing) and the graph is not<br>transformed.<br><br>Do I understand correctly why the transformation fails for loops? How would you suggest to solve this problem?<br><br>Regards<br></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Jeffrey Benjamin Brown</div></div>
</div>