X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;ds=sidebyside;f=AST.icl;h=d2d1a95c6103afe1203f35e664cd3123755ff234;hb=c5fb28639ae923d9b55f5832e45186911e610991;hp=64366197d941175c378a1a7ba69e8f5c711bef9c;hpb=14e9a339d121ce18c420e4cb99f6bad86d1a5b45;p=cc1516.git diff --git a/AST.icl b/AST.icl index 6436619..d2d1a95 100644 --- a/AST.icl +++ b/AST.icl @@ -26,6 +26,9 @@ instance print FunDecl where ["{\n\t":printersperse "\n\t" vs] ++ ["\n":printStatements ss 1] ++ ["}\n"] +instance toString FunDecl where + toString fd = concat $ print fd + printStatements :: [Stmt] Int -> [String] printStatements [] i = [] printStatements [s:ss] i = (case s of @@ -110,6 +113,7 @@ instance print Expr where print (FunExpr _ id as fs) = printFunCall id as fs print (EmptyListExpr _) = ["[]"] print (TupleExpr _ (e1, e2)) = ["(":print e1] ++ [",":print e2] ++ [")"] + print (LambdaExpr _ args e) = ["\\":args] ++ ["->": print e] instance toString Expr where toString e = concat $ print e