aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lux.clj8
-rw-r--r--src/lux/analyser.clj12
-rw-r--r--src/lux/analyser/env.clj8
-rw-r--r--src/lux/base.clj10
4 files changed, 23 insertions, 15 deletions
diff --git a/src/lux.clj b/src/lux.clj
index eb8729053..c5d192879 100644
--- a/src/lux.clj
+++ b/src/lux.clj
@@ -19,10 +19,4 @@
(println "Please provide a module name to compile."))
_
- (println "Can't understand command."))
- (System/exit 0)
- )
-
-(comment
- (-main "compile" "program")
- )
+ (println "Can't understand command.")))
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj
index 8de389e56..9940bb354 100644
--- a/src/lux/analyser.clj
+++ b/src/lux/analyser.clj
@@ -328,6 +328,9 @@
(defn ^:private aba5 [analyse eval! compile-module compile-token exo-type token]
(|case token
;; Objects
+ (&/$FormS (&/$Cons [_ (&/$SymbolS _ "_jvm_null")] (&/$Nil)))
+ (&&host/analyse-jvm-null analyse exo-type)
+
(&/$FormS (&/$Cons [_ (&/$SymbolS _ "_jvm_null?")]
(&/$Cons ?object
(&/$Nil))))
@@ -568,9 +571,6 @@
(defn ^:private aba2 [analyse eval! compile-module compile-token exo-type token]
(|case token
- (&/$SymbolS ?ident)
- (&&lux/analyse-symbol analyse exo-type ?ident)
-
(&/$FormS (&/$Cons [_ (&/$SymbolS _ "_lux_case")]
(&/$Cons ?value ?branches)))
(&&lux/analyse-case analyse exo-type ?value ?branches)
@@ -667,10 +667,10 @@
(&/$TagS ?ident)
(analyse-variant+ analyse exo-type ?ident &/Nil$)
-
- (&/$SymbolS _ "_jvm_null")
- (&&host/analyse-jvm-null analyse exo-type)
+ (&/$SymbolS ?ident)
+ (&&lux/analyse-symbol analyse exo-type ?ident)
+
_
(aba2 analyse eval! compile-module compile-token exo-type token)
))
diff --git a/src/lux/analyser/env.clj b/src/lux/analyser/env.clj
index 04dce90db..ec0dc4a92 100644
--- a/src/lux/analyser/env.clj
+++ b/src/lux/analyser/env.clj
@@ -65,4 +65,10 @@
(def captured-vars
(fn [state]
- (return* state (->> state (&/get$ &/$envs) &/|head (&/get$ &/$closure) (&/get$ &/$mappings)))))
+ (|case (&/get$ &/$envs state)
+ (&/$Nil)
+ (fail* "[Analyser Error] Can't obtain captured vars without environments.")
+
+ (&/$Cons env _)
+ (return* state (->> env (&/get$ &/$closure) (&/get$ &/$mappings))))
+ ))
diff --git a/src/lux/base.clj b/src/lux/base.clj
index 5f6dbaf85..b8ca60465 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -887,7 +887,9 @@
init
[_ _]
- false))
+ init
+ ;; (assert false)
+ ))
(defn ^:private enumerate* [idx xs]
"(All [a] (-> Int (List a) (List (, Int a))))"
@@ -996,3 +998,9 @@
|every? true and
|any? false or)
+
+(defn m-comp [f g]
+ (All [a b c] (-> (-> b (Lux c)) (-> a (Lux b)) (-> a (Lux c))))
+ (fn [x]
+ (|do [y (g x)]
+ (f y))))