X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=AST.icl;h=6f2e5c63a50b3c5d406a01c46d5c235314e3630d;hb=220cb1cc56feab3f818503838b3afd7ea2225403;hp=43c46f7052cedda36a1467f773eb480d85d3c6a7;hpb=e34b5f088ff9a86da61afbbe91c2c88f895673c7;p=cc1516.git diff --git a/AST.icl b/AST.icl index 43c46f7..6f2e5c6 100644 --- a/AST.icl +++ b/AST.icl @@ -63,7 +63,7 @@ instance print Type where print BoolType = print "Bool" print CharType = print "Char" print VoidType = print "Void" - print (t1 ->> t2) = print t1 ++ [" -> ":print t2] + print (t1 ->> t2) = ["(":print t1 ++ [" -> ":print t2]] ++ [")"] instance print String where print s = [s] @@ -75,7 +75,7 @@ instance print FieldSelector where print FieldFst = print "fst" instance print VarDef where - print (VarDef i fs) = printersperse "." [i:flatten $ map print fs] + print (VarDef i fs) = printersperse "." [i:printersperse "" fs] instance toString Op2 where toString o = case o of @@ -110,3 +110,6 @@ printFunCall s args = [s, "(":printersperse "," args] ++ [")"] derive gEq Op2 instance == Op2 where (==) o1 o2 = gEq{|*|} o1 o2 + +instance zero Pos where + zero = {line=0, col=0}