diff options
Diffstat (limited to '')
-rw-r--r-- | src/lang.clj | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lang.clj b/src/lang.clj new file mode 100644 index 000000000..45c6013d4 --- /dev/null +++ b/src/lang.clj @@ -0,0 +1,26 @@ +(ns lang + (:require (lang [lexer :as &lexer] + [parser :as &parser] + [compiler :as &compiler]) + :reload)) + +(defn write-file [file data] + (with-open [stream (java.io.BufferedOutputStream. (java.io.FileOutputStream. file))] + (.write stream data))) + +(def ^:private +state+ + {:globals {} + :stack {} + :forms '()}) + +(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))] + (write-file "output.class" class-data)) + + + ) |