Assignment 3 Solutions
Pablo IR
The Haskell definition of Pablo IR together with an implementation of show functions is in the file PabloIR.hs.
Simplified Compiler
A simplified compiler (ignoring SSA form and phi nodes) is available in the file pabloc1.hs.
Download
To download these Pablo compiler source files together with some test inputs use the following command:
svn export http://parabix.costar.sfu.ca/svn/proto/pabloH pabloH
Then use ghci interactively.
pabloH$ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :load pabloc1 [1 of 3] Compiling PabloIR ( PabloIR.hs, interpreted ) [2 of 3] Compiling ParsePablo ( ParsePablo.hs, interpreted ) [3 of 3] Compiling PabloCompiler1 ( pabloc1.hs, interpreted ) Ok, modules loaded: PabloCompiler1, ParsePablo, PabloIR. *PabloCompiler1> doCompile "test1.pablo" entry: %a = and %b, %c %tmp0 = or %x, %y %tmp1 = and %a, %tmp0 %tmp2 = add %tmp1, %tmp0 %tmp3 = xor %tmp2, %tmp0 %d = or %tmp3, %a %tmp4 = or %d, %e cbr %tmp4, %if.body5, %if.else5 if.body5: %e = or %e, %f %tmp6 = and %y, %z %g = xor %h, %tmp6 br %if.end5 if.else5: %g = 0 br %if.end5 if.end5: %out = xor %out, %e ret
Updated Tue Nov. 10 2015, 08:20 by cameron.