aboutsummaryrefslogtreecommitdiff
path: root/src/lang.clj
diff options
context:
space:
mode:
authorEduardo Julian2014-12-15 00:56:48 -0400
committerEduardo Julian2014-12-15 00:56:48 -0400
commit5883c0d11c21a74ba493ea369ff01d7baed80a41 (patch)
tree390a7062ad4d96b5000e422723d23c8d591b24fe /src/lang.clj
parent604e1d0c108f6153b599684b4b7828eae709118a (diff)
Added tuples.
Diffstat (limited to '')
-rw-r--r--src/lang.clj93
1 files changed, 1 insertions, 92 deletions
diff --git a/src/lang.clj b/src/lang.clj
index f68d6eeb3..c497c9923 100644
--- a/src/lang.clj
+++ b/src/lang.clj
@@ -11,92 +11,7 @@
(.write stream data)))
(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 "test2" syntax)]
- (write-file "test2.class" class-data))
-
- (->> (slurp "test2.lang")
- &lexer/lex
- &parser/parse
- (&compiler/compile "test2")
- (write-file "test2.class"))
-
- (->> (slurp "test2.lang")
- &lexer/lex
- &parser/parse
- (&analyser/analyse "test2"))
-
- (let [source-code (slurp "test2.lang")
- tokens (&lexer/lex source-code)
- ;; _ (prn 'tokens tokens)
- syntax (&parser/parse tokens)
- ;; _ (prn 'syntax syntax)
- ann-syntax (&analyser/analyse "test2" syntax)
- _ (prn 'ann-syntax ann-syntax)
- class-data (&compiler/compile "test2" syntax)]
- (write-file "test2.class" class-data))
-
- (let [source-code (slurp "test2.lang")
- tokens (&lexer/lex source-code)
- ;; _ (prn 'tokens tokens)
- syntax (&parser/parse tokens)
- ;; _ (prn 'syntax syntax)
- ann-syntax (&analyser/analyse "test2" syntax)
- ;; _ (prn 'ann-syntax ann-syntax)
- class-data (&compiler/compile "test2" ann-syntax)]
- (write-file "test2.class" class-data))
-
- (let y ...
- (lambda x (* x y)))
-
- (let y ...
- (proxy Function1
- (apply1 [_ x] (* x y))))
-
- (def (foo w x y z)
- ($ * w x y z))
- =>
- (let f1 (proxy Function1 [w x y]
- (apply1 [_ z]
- (STATIC-METHOD w x y z)))
- (let f2 (proxy Function2 [w x]
- (apply1 [_ y]
- f1)
- (apply2 [_ y z]
- (STATIC-METHOD w x y z)))
- (proxy Function4
- (apply1 [_ w x]
- (proxy Function3 [w]
- (apply1 [_ x]
- f2)
- (apply2 [_ x y]
- f1)
- (apply3 [_ x y z]
- (STATIC-METHOD w x y z))))
- (apply2 [_ w x]
- f2)
- (apply3 [_ w x y]
- f1)
- (apply4 [_ w x y z]
- (STATIC-METHOD w x y z)))))
-
- <OR AS...>
- (proxy Function []
- (apply [_ w]
- (proxy Function [w]
- (apply [_ x]
- (proxy Function [w x]
- (apply [_ y]
- (proxy Function [w x y]
- (apply [_ z]
- (STATIC-METHOD w x y z)))))))))
-
-
- ;; TODO: Add tuples.
+ ;; TODO: Add lambdas.
;; TODO: Add pattern-matching.
;; TODO: Add thunks.
;; TODO: Add Java-interop.
@@ -108,7 +23,6 @@
;; TODO: Re-implement compiler in language.
;; TODO: Add all the missing literal types.
;; TODO: Allow strings to have escape characters.
- ;; TODO: Add lambdas.
;; TODO: Add "do" expressions.
;; TODO: Fold all closure classes into one.
;; TODO: When doing partial application, skip "apply" and just call constructor appropiatedly.
@@ -126,11 +40,6 @@
class-data (&compiler/compile "test2" ann-syntax)]
(write-file "test2.class" class-data))
- ;; jar cvf test2.jar test2 test2.class
- ;; java -cp "test2.jar" test2
- ;; jar cvf test2.jar test2 test2.class && java -cp "test2.jar" test2
- ;; jar cvf test2.jar test2 test2.class another.class && java -cp "test2.jar" test2
-
;; jar cvf test2.jar *.class test2 && java -cp "test2.jar" test2
)