+ g (WhileStmt cond th) =
+ fresh >>= \startLabel->
+ fresh >>= \endLabel ->
+ tell [Lab startLabel] >>|
+ g cond >>|
+ tell [Instr "brf" [L endLabel] "branch end while"] >>|
+ mapM_ g th >>|
+ tell [Instr "bra" [L startLabel] "branch start while"] >>|
+ tell [Lab endLabel]
+ g (AssStmt (VarDef k fs) e) =
+ g e >>|
+ abort "Shit, an assignment, figure out something with storing vars or something"
+ g (FunStmt _ _) = abort "CodeGen FunStmt unused" //not used
+ g (ReturnStmt Nothing) = tell [Instr "ret" [] ""]
+ g (ReturnStmt (Just e)) =
+ g e >>|
+ tell [Instr "str" [Raw "RR"] ""] >>|
+ g (ReturnStmt Nothing)
+