diff options
author | Eduardo Julian | 2014-12-07 19:46:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2014-12-07 19:46:57 -0400 |
commit | 98b427b8835eca42c0ee401a4deb842a9445a737 (patch) | |
tree | f70079f05df9f49ffe15c0d3cd15b78232a6cdd2 /src/lang.clj | |
parent | 0bccd6a2313dc5eadb635d1fbf02dbb0a5ff2cfe (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 '')
-rw-r--r-- | src/lang.clj | 14 |
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")) ) |