From e7d26b7d42640f1d45ce7aa7f055d4854bbada5b Mon Sep 17 00:00:00 2001 From: pimjager Date: Thu, 19 May 2016 17:11:40 +0200 Subject: [PATCH] annotations --- gen.icl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -- 2.20.1