From: pimjager Date: Thu, 19 May 2016 15:11:40 +0000 (+0200) Subject: annotations X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=e7d26b7d42640f1d45ce7aa7f055d4854bbada5b;p=cc1516.git annotations --- diff --git a/gen.icl b/gen.icl index 59d04e4..9c43c75 100644 --- a/gen.icl +++ b/gen.icl @@ -168,6 +168,7 @@ instance g Stmt where foldVarDecl :: Int VarDecl -> Gen Int foldVarDecl x (VarDecl _ _ k e) = g e + >>| annote x k >>| updateAdressbook (extend k (ADDR x)) >>| pure (x + 1) addVars :: [String] -> (Addressbook -> Addressbook) @@ -182,12 +183,16 @@ instance g FunDecl where updateAdressbook (addVars args) >>| tell [Lab k] >>| tell [Instr "link" [Lit 0] ""] >>| - //then generate functions for the VarDecls + //add the vars foldM foldVarDecl 1 vds >>| - //then the main function + //and the statements mapM_ g stms >>| updateAdressbook (const oldMap) >>| pure () +annote :: Int -> String -> Gen () +annote pos key = + tell [Instr "annote" [Raw "MP", Lit pos, Lit pos, Raw "orange", Raw key] ""] + class print a :: a -> [String] instance print Instr where