+instance g FunDecl where
+ g (FunDecl _ k _ _ vds stms) =
+ //varDecls can call the enclosing function, so first reserve a label for it
+ (\l-> if (k=="main") "main" (l+++"_"+++k)) <$> fresh >>= \lbl->
+ changeGenMap (extend k (FUNC lbl)) >>|
+ //then generate functions for the VarDecls
+ genMap >>= \oldMap ->
+ mapM_ g vds >>|
+ //then the main function
+ tell [Lab lbl] >>|
+ mapM_ g stms >>|
+ changeGenMap (const oldMap) >>| pure ()