summaryrefslogtreecommitdiff
path: root/AST.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-11-18 19:32:45 +0100
committertomsmeding <tom.smeding@gmail.com>2019-11-18 19:39:19 +0100
commit6b968c123b25cda9309768a9186b07997d50c92a (patch)
tree49bc7c391af7ad6a7f7a9349d94860068918c6f4 /AST.hs
parent572bda80e20165485779e9ccfc0242f85df30c31 (diff)
Split off macro expansion from analyseValue
Diffstat (limited to 'AST.hs')
-rw-r--r--AST.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/AST.hs b/AST.hs
index df946dd..f8b5e5b 100644
--- a/AST.hs
+++ b/AST.hs
@@ -13,6 +13,7 @@ data Value
| VString String
| VName Name
| VQuoted Value
+ | VDefine Name Value
| VLambda [Name] Value
| VLet [(Name, Value)] Value
| VBuiltin String
@@ -29,6 +30,7 @@ instance Show Value where
show (VString s) = show s
show (VName n) = n
show (VQuoted e) = '\'' : show e
+ show (VDefine n v) = "(define " ++ n ++ " " ++ show v ++ ")"
show (VLambda as v) = "(lambda (" ++ intercalate " " as ++ ") " ++ show v ++ ")"
show (VLet ps v) = "(let (" ++ intercalate " " ["(" ++ n ++ " " ++ show w ++ ")" | (n, w) <- ps] ++ ") " ++ show v ++ ")"
show (VBuiltin str) = "[[builtin " ++ str ++ "]]"