aboutsummaryrefslogtreecommitdiff
path: root/lux-bootstrapper
diff options
context:
space:
mode:
authorEduardo Julian2020-12-11 22:40:31 -0400
committerEduardo Julian2020-12-11 22:40:31 -0400
commitdff517cbdb9a1c80028782c62ad91c71ddb34909 (patch)
treef69b4005e8b6dc9699a410554ce4571f60d9e0ee /lux-bootstrapper
parent9af671a34728b35c48bff2ba163c371dc5084946 (diff)
Improved parsing speed for Lux code.
Diffstat (limited to '')
-rw-r--r--lux-bootstrapper/src/lux/analyser/proc/common.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj2
-rw-r--r--lux-bootstrapper/src/lux/optimizer.clj17
3 files changed, 17 insertions, 6 deletions
diff --git a/lux-bootstrapper/src/lux/analyser/proc/common.clj b/lux-bootstrapper/src/lux/analyser/proc/common.clj
index 13d9d0cbd..1226e47f2 100644
--- a/lux-bootstrapper/src/lux/analyser/proc/common.clj
+++ b/lux-bootstrapper/src/lux/analyser/proc/common.clj
@@ -236,9 +236,7 @@
=else (&&/analyse-1 analyse exo-type ?else)]
(return (&/|list (&&/|meta exo-type _location
(&&/$proc (&/T ["lux" "syntax char case!"])
- (&/|list =input
- (&&/|meta exo-type _location (&&/$tuple (&/|map &/|second =pairs)))
- =else)
+ (&/$Cons =input (&/$Cons =else (&/|map &/|second =pairs)))
(&/|map &/|first =pairs)))))))
(defn analyse-proc [analyse exo-type proc ?values]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
index 569aa44ad..526e9d491 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
@@ -346,7 +346,7 @@
(return nil)))
(defn ^:private compile-syntax-char-case! [compile ?values ?patterns]
- (|do [:let [(&/$Cons ?input (&/$Cons [_ (&a/$tuple ?matches)] (&/$Cons ?else (&/$Nil)))) ?values]
+ (|do [:let [(&/$Cons ?input (&/$Cons ?else ?matches)) ?values]
^MethodVisitor *writer* &/get-writer
:let [pattern-labels (&/|map (fn [_] (new Label)) ?patterns)
matched-patterns (->> (&/zip2 ?patterns pattern-labels)
diff --git a/lux-bootstrapper/src/lux/optimizer.clj b/lux-bootstrapper/src/lux/optimizer.clj
index 6e235e084..c8c8af02f 100644
--- a/lux-bootstrapper/src/lux/optimizer.clj
+++ b/lux-bootstrapper/src/lux/optimizer.clj
@@ -813,6 +813,14 @@
($ann _value-expr _type-expr)
(&/T [meta ($ann (optimize-iter arity _value-expr) _type-expr)])
+ ($proc ["lux" "syntax char case!"] (&/$Cons ?input (&/$Cons ?else ?matches)) ?special-args)
+ (&/T [meta ($proc (&/T ["lux" "syntax char case!"])
+ (&/$Cons ?input
+ (&/$Cons (optimize-iter arity ?else)
+ (&/|map (partial optimize-iter arity)
+ ?matches)))
+ ?special-args)])
+
_
optim
)))
@@ -850,6 +858,11 @@
(or (contains-self-reference? func)
(&/fold stepwise-test false args))
+ ($proc ["lux" "syntax char case!"] (&/$Cons ?input (&/$Cons ?else ?matches)) ?special-args)
+ (or (contains-self-reference? ?input)
+ (contains-self-reference? ?else)
+ (&/fold stepwise-test false ?matches))
+
($proc proc-ident args special-args)
(&/fold stepwise-test false args)
@@ -871,7 +884,7 @@
(or (contains-self-reference? _test)
(contains-self-reference? _then)
(contains-self-reference? _else))
-
+
_
false
)))
@@ -946,7 +959,7 @@
(&/|map (partial loop-transform register-offset direct?) args))])
;; Captured-vars are ignored because they'll be handled properly at shift-function-body
-
+
($proc proc-ident args special-args)
(&/T [meta ($proc proc-ident (&/|map (partial loop-transform register-offset direct?) args) special-args)])