Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data flow optimisation using HOOPL

I am Haskell programmer ( I generally implement algorithms in Haskell ) and trying to understand HOOPL library but I am not able to decode it. I don't have compiler background ( currently learning from Coursera and Compilers: Principles, Techniques, and Tools ) and It would be great if you can suggest me a systematic way to proceed for understanding HOOPL library ( what is the prerequisite ). Lets say I have a small Haskell code on which I want to apply data flow optimization using HOOPL

add :: Int -> Int -> Int
add x y = z where
   x' = 1
   y' = 1 -- this will be dead code elimination 
   z = x' + 1 

How to write HOOPL code to optimise this. It would be great if you can give a bit better example and pardon me if I sound stupid.

like image 219
keep_learning Avatar asked May 29 '12 19:05

keep_learning


1 Answers

A good place to start is pulling the git repo, which has lots of additional files compared to what's on Hackage. Lookin the /testing subdirectory, and you can see some simple code defining a basic imperative language and some optimizations on it.

like image 73
sclv Avatar answered Sep 30 '22 13:09

sclv