aboutsummaryrefslogtreecommitdiff
path: root/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AST.hs')
-rw-r--r--AST.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/AST.hs b/AST.hs
index 197edf9..dae2631 100644
--- a/AST.hs
+++ b/AST.hs
@@ -63,6 +63,7 @@ data Literal
| LChar Char
| LVar Name
| LCall Name [Expression]
+ | LStr String
deriving (Show, Eq)
@@ -74,8 +75,8 @@ sizeof (TArr _ _) = 8
instance Pretty Program where
prettyI i (Program vars funcs) =
- concatMap (++ ("\n" ++ indent i)) $
- map (prettyI i) vars ++ map (prettyI i) funcs
+ intercalate ("\n" ++ indent i) (map (prettyI i) vars ++ map (prettyI i) funcs)
+ ++ "\n"
where
indent n = replicate (2*n) ' '
@@ -182,3 +183,4 @@ instance Pretty Literal where
prettyI _ (LVar n) = n
prettyI i (LCall n al) =
n ++ "(" ++ intercalate ", " (map (prettyI i) al) ++ ")"
+ prettyI _ (LStr s) = show s