From 98b427b8835eca42c0ee401a4deb842a9445a737 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 Dec 2014 19:46:57 -0400 Subject: 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). --- src/lang.clj | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/lang.clj') 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")) ) -- cgit v1.2.3