aboutsummaryrefslogtreecommitdiff
path: root/src/lang.clj
diff options
context:
space:
mode:
authorEduardo Julian2014-12-07 19:46:57 -0400
committerEduardo Julian2014-12-07 19:46:57 -0400
commit98b427b8835eca42c0ee401a4deb842a9445a737 (patch)
treef70079f05df9f49ffe15c0d3cd15b78232a6cdd2 /src/lang.clj
parent0bccd6a2313dc5eadb635d1fbf02dbb0a5ff2cfe (diff)
Cleaned up a lot of useless code and removed the state monad from the compilation phase (the ASM library already works as a state monad).
Diffstat (limited to 'src/lang.clj')
-rw-r--r--src/lang.clj14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lang.clj b/src/lang.clj
index d5c166529..77235dcf0 100644
--- a/src/lang.clj
+++ b/src/lang.clj
@@ -8,20 +8,18 @@
(with-open [stream (java.io.BufferedOutputStream. (java.io.FileOutputStream. file))]
(.write stream data)))
-(def ^:private +state+
- {:globals {}
- :stack {}
- :forms '()
- :classes {}})
-
(comment
(let [source-code (slurp "test2.lang")
tokens (&lexer/lex source-code)
_ (prn 'tokens tokens)
syntax (&parser/parse tokens)
_ (prn 'syntax syntax)
- class-data (&compiler/compile (update-in +state+ [:forms] concat syntax))]
+ class-data (&compiler/compile syntax)]
(write-file "output.class" class-data))
-
+ (->> (slurp "test2.lang")
+ &lexer/lex
+ &parser/parse
+ &compiler/compile
+ (write-file "output.class"))
)