projects
/
kaleidoscope-hs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8cd4f63
)
Generate code for externs
author
Luke Lau
<luke_lau@icloud.com>
Sat, 18 May 2019 23:29:49 +0000
(
00:29
+0100)
committer
Luke Lau
<luke_lau@icloud.com>
Sun, 19 May 2019 13:17:16 +0000
(14:17 +0100)
Main.hs
patch
|
blob
|
history
diff --git
a/Main.hs
b/Main.hs
index 2eae262967be844fff1886ac2d34318912b17e53..cf20ab898fa2bd9744d698f29ee8dffea73b1bfe 100644
(file)
--- a/
Main.hs
+++ b/
Main.hs
@@
-41,6
+41,9
@@
buildAST (Function (Prototype nameStr paramStrs) body) = do
flip runReaderT binds $ buildExpr body >>= ret
where params = zip (repeat Type.double) (map fromString paramStrs)
+buildAST (Extern (Prototype nameStr params)) =
+ extern (fromString nameStr) (replicate (length params) Type.double) Type.double
+
buildAST (TopLevelExpr x) = function "__anon_expr" [] Type.double $
const $ flip runReaderT mempty $ buildExpr x >>= ret