diff options
author | Eduardo Julian | 2015-03-01 23:39:58 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-03-01 23:39:58 -0400 |
commit | 4908fef51307348d8469d8e95885fa9a0d8eb821 (patch) | |
tree | 4b958d840e5f80e28bc8f9305cfd12ced971c57f /source | |
parent | ae5c933a5208c51fe30d0b9dc976690ee8bc138a (diff) |
Simplified the compiler by using arrays to encode tuples & variants instead of using custom classes for that.
Diffstat (limited to '')
-rw-r--r-- | source/lux.lux | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/source/lux.lux b/source/lux.lux index db827760d..641be09ca 100644 --- a/source/lux.lux +++ b/source/lux.lux @@ -2,40 +2,6 @@ (jvm;interface Function (: apply (-> [java.lang.Object] java.lang.Object))) -(jvm;class Tuple0 java.lang.Object - []) -(jvm;class Tuple1 java.lang.Object - [[java.lang.Object _0]]) -(jvm;class Tuple2 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1]]) -(jvm;class Tuple3 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2]]) -(jvm;class Tuple4 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2] [java.lang.Object _3]]) -(jvm;class Tuple5 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2] [java.lang.Object _3] - [java.lang.Object _4]]) -(jvm;class Tuple6 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2] [java.lang.Object _3] - [java.lang.Object _4] [java.lang.Object _5]]) -(jvm;class Tuple7 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2] [java.lang.Object _3] - [java.lang.Object _4] [java.lang.Object _5] - [java.lang.Object _6]]) -(jvm;class Tuple8 java.lang.Object - [[java.lang.Object _0] [java.lang.Object _1] - [java.lang.Object _2] [java.lang.Object _3] - [java.lang.Object _4] [java.lang.Object _5] - [java.lang.Object _6] [java.lang.Object _7]]) - -(jvm;class Variant java.lang.Object - [[java.lang.String tag] [java.lang.Object value]]) - ## Base functions & macros (def' let' (lambda' _ tokens @@ -86,6 +52,21 @@ [(#Cons [output #Nil]) state]))) (declare-macro def) +## (def (defmacro tokens state) +## (let' fn-def (case' tokens +## (#Cons [(#Form (#Cons [(#Ident ?name) (#Cons [(#Ident ?tokens) (#Cons [(#Ident ?state) #Nil])])])) +## (#Cons [body #Nil])]) +## (#Form (#Cons [(#Form (#Cons [(#Ident "lux;def") +## (#Cons [(#Ident ?name) +## (#Cons [(#Ident ?tokens) +## (#Cons [(#Ident ?state) +## #Nil])])])])) +## (#Cons [body +## #Nil])]))) +## (let' declaration [] +## [(#Cons [fn-def (#Cons [declaration #Nil])]) state]))) +## (declare-macro defmacro) + (def (comment tokens state) [#Nil state]) (declare-macro comment) |