[Haskell-cafe] Transforming graphs with loops with Hoopl

Jeffrey Brown jeffbrown.the at gmail.com
Sun May 1 18:35:59 UTC 2016


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?

On Sun, May 1, 2016 at 10:59 AM, Anakreontas <anakreonmejdi at gmail.com>
wrote:

> I am trying to implement a program transformation with Hoopl. The
> transformation replaces a particular statement with variable
> declarations provided that the variables have not been previously
> declared. A map keeps track of declared variables where the map keys
> store variable names.
>
> The transformation works only for programs without loops. In the
> program below, it should replace line
> 2 rec #3 INxt B37H00G
> with
> 1 Global Field B37H00G
> 2 Global Array B37HO3R
> 3 rec #3 INxt B37H00G
> but it doesn't.
>
> === Example graph ==
> 0 goto L4
> 1 L4:
> 2 rec #3 INxt B37H00G
> 3 while #3 goto L5 goto L2
> 4 L5:
> 5 Global Field VSTF01a
> 6 goto L4
> 7 L2:
>
> I think the reason it fails is because there are two paths leading to
> L4, one from the program start (line 0) and a second when the loop
> repeats from line 6. In the first case the transformation produces the
> substitution graph since the two variables are not in the map. In the
> analysis of the second path however, the variables are in the name space so
> the rewrite function returns Nothing. In the end, the second
> transformation result is preserved (i.e. Nothing) and the graph is not
> transformed.
>
> Do I understand correctly why the transformation fails for loops? How
> would you suggest to solve this problem?
>
> Regards
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>


-- 
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160501/b5a04f3f/attachment.html>


More information about the Haskell-Cafe mailing list