summaryrefslogtreecommitdiff
path: root/CompilerMacros.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-11-26 13:46:29 +0100
committertomsmeding <tom.smeding@gmail.com>2019-11-26 13:46:29 +0100
commit5f86130930c19277fbf0ef3433cc43ab93aacf3f (patch)
tree22c11dc678a6262c44a34630076824f941193043 /CompilerMacros.hs
parent9de16e245424e62318cdce4909e33c256f585cb6 (diff)
declare defines for top-level mutual recursion
Diffstat (limited to 'CompilerMacros.hs')
-rw-r--r--CompilerMacros.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/CompilerMacros.hs b/CompilerMacros.hs
index a2d9600..086ad2e 100644
--- a/CompilerMacros.hs
+++ b/CompilerMacros.hs
@@ -13,6 +13,9 @@ process (VList [VName "define", VName name, VList args, body])
process (VList [VName "define", VName name, value]) = VDefine name (process value)
process (VList (VName "define" : _)) = error "Invalid 'define' syntax"
+process (VList [VName "declare", VName name]) = process (VDeclare name)
+process (VList (VName "declare" : _)) = error "Invalid 'declare' syntax"
+
process (VList [VName "lambda", VList args, body])
| Just names <- mapM fromVName args = process (VLambda names body)
| otherwise = error "Invalid 'lambda' syntax: Invalid argument list"
@@ -44,6 +47,7 @@ process (VList [VName "cond"]) = error "Invalid 'cond' syntax: Even number of ar
process (VList values) = VList (map process values)
+process (VDeclare name) = VDeclare name
process (VDefine name body) = VDefine name (process body)
process (VLambda args body) = VLambda args (process body)
process (VLambdaRec recname args body) = VLambdaRec recname args (process body)