implementation module gen
-
import StdMisc
import StdList
import StdOverloaded
:: Gen a :== RWST Label SSMProgram (GenMap, [Label]) (Either GenError) a
labelStream :: [Label]
-labelStream = map (\i-> concat ["lbl_", toString i]) [1..]
+labelStream = ["lbl_" +++ toString i\\i<-[1..]]
gen :: AST -> String
gen (AST fds) = case evalRWST prog "" ('Map'.newMap, labelStream) of
//helper functions for the gen monad
genMap :: Gen GenMap
genMap = gets fst
+
changeGenMap :: (GenMap -> GenMap) -> Gen GenMap
changeGenMap f = modify (appFst f) >>| genMap
toString (Raw s) = s
instance toString SSMProgram where
- toString p = concat $ intersperse " " $ map (\i-> concat $ intersperse " " $ print i) p
\ No newline at end of file
+ toString p = concat $ intersperse " " $ map (\i-> concat $ intersperse " " $ print i) p