aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/compiler
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/compiler.lux40
-rw-r--r--new-luxc/source/luxc/compiler/base.jvm.lux3
-rw-r--r--new-luxc/source/luxc/compiler/common.jvm.lux22
-rw-r--r--new-luxc/source/luxc/compiler/expr.jvm.lux3
-rw-r--r--new-luxc/source/luxc/compiler/runtime.jvm.lux6
-rw-r--r--new-luxc/source/luxc/compiler/statement.jvm.lux3
6 files changed, 38 insertions, 39 deletions
diff --git a/new-luxc/source/luxc/compiler.lux b/new-luxc/source/luxc/compiler.lux
index 92d4bf8ab..55fe3c738 100644
--- a/new-luxc/source/luxc/compiler.lux
+++ b/new-luxc/source/luxc/compiler.lux
@@ -3,7 +3,7 @@
(lux (control monad)
(concurrency ["A" atom]
["P" promise])
- (data ["E" error]
+ (data ["R" result]
[text "T/" Hash<Text>]
text/format
(coll ["D" dict]
@@ -70,19 +70,19 @@
(Lux Code)
(function [compiler]
(case (&parser;parse (get@ #;source compiler))
- (#E;Error error)
- (#E;Error error)
+ (#R;Error error)
+ (#R;Error error)
- (#E;Success [source' output])
- (#E;Success [(set@ #;source source' compiler)
+ (#R;Success [source' output])
+ (#R;Success [(set@ #;source source' compiler)
output]))))
(def: (compile-module source-dirs module-name compiler)
- (-> (List &;Path) Text Compiler (P;Promise (E;Error Compiler)))
+ (-> (List &;Path) Text Compiler (P;Promise (R;Result Compiler)))
(do P;Monad<Promise>
[?input (&io;read-module source-dirs module-name)]
(case ?input
- (#E;Success [file-name file-content])
+ (#R;Success [file-name file-content])
(let [compilation (do Monad<Lux>
[_ (with-active-compilation [module-name
file-name
@@ -95,17 +95,17 @@
## (&module;generate-descriptor module-name)
)]
(case (macro;run' compiler compilation)
- (#E;Success [compiler module-descriptor])
+ (#R;Success [compiler module-descriptor])
(do @
[## _ (&io;write-module module-name module-descriptor)
]
- (wrap (#E;Success compiler)))
+ (wrap (#R;Success compiler)))
- (#E;Error error)
- (wrap (#E;Error error))))
+ (#R;Error error)
+ (wrap (#R;Error error))))
- (#E;Error error)
- (wrap (#E;Error error)))))
+ (#R;Error error)
+ (wrap (#R;Error error)))))
(jvm-import org.objectweb.asm.MethodVisitor)
@@ -135,11 +135,11 @@
(array-store +2 (:! (Class Object) Integer.TYPE))
(array-store +3 (:! (Class Object) Integer.TYPE)))]
(class-for java.lang.ClassLoader))
- (#E;Success method)
+ (#R;Success method)
(do-to method
(AccessibleObject.setAccessible [true]))
- (#E;Error error)
+ (#R;Error error)
(error! error)))
(def: (memory-class-loader store)
@@ -155,10 +155,10 @@
(:! Object (l2i 0))
(:! Object (l2i (nat-to-int (array-length bytecode))))))]
ClassLoader::defineClass)
- (#E;Success output)
+ (#R;Success output)
[]
- (#E;Error error)
+ (#R;Error error)
(error! error))
_
@@ -201,14 +201,14 @@
#;host (:! Void host)})
(def: (or-crash! action)
- (All [a] (-> (P;Promise (E;Error a)) (P;Promise a)))
+ (All [a] (-> (P;Promise (R;Result a)) (P;Promise a)))
(do P;Monad<Promise>
[?output action]
(case ?output
- (#E;Error error)
+ (#R;Error error)
(error! error)
- (#E;Success output)
+ (#R;Success output)
(wrap output))))
(def: #export (compile-program program target sources)
diff --git a/new-luxc/source/luxc/compiler/base.jvm.lux b/new-luxc/source/luxc/compiler/base.jvm.lux
index f5784319a..01a97aec4 100644
--- a/new-luxc/source/luxc/compiler/base.jvm.lux
+++ b/new-luxc/source/luxc/compiler/base.jvm.lux
@@ -3,8 +3,7 @@
(lux (control monad)
[io #- run]
(concurrency ["A" atom])
- (data ["E" error]
- [text]
+ (data [text]
text/format)
host)
(luxc ["&" base]))
diff --git a/new-luxc/source/luxc/compiler/common.jvm.lux b/new-luxc/source/luxc/compiler/common.jvm.lux
index d7abc1ff1..bd5487ef6 100644
--- a/new-luxc/source/luxc/compiler/common.jvm.lux
+++ b/new-luxc/source/luxc/compiler/common.jvm.lux
@@ -1,7 +1,7 @@
(;module:
lux
(lux (concurrency ["A" atom])
- (data ["E" error]
+ (data ["R" result]
(coll ["D" dict]))
[macro]
[host #+ jvm-import]))
@@ -33,13 +33,13 @@
(:! Host)
(get@ #visitor)))
-(def: (visitor::put visitor compiler)
- (-> MethodVisitor Compiler Compiler)
+(def: (visitor::put ?visitor compiler)
+ (-> (Maybe MethodVisitor) Compiler Compiler)
(update@ #;host
(function [host]
(|> host
(:! Host)
- (set@ #visitor (#;Some visitor))
+ (set@ #visitor ?visitor)
(:! Void)))
compiler))
@@ -48,18 +48,18 @@
(function [compiler]
(case (visitor::get compiler)
#;None
- (#E;Error "No visitor has been set.")
+ (#R;Error "No visitor has been set.")
(#;Some visitor)
- (#E;Success [compiler visitor]))))
+ (#R;Success [compiler visitor]))))
(def: #export (with-visitor visitor body)
(All [a] (-> MethodVisitor (Lux a) (Lux a)))
(function [compiler]
- (case (macro;run' (visitor::put visitor compiler) body)
- (#E;Error error)
- (#E;Error error)
+ (case (macro;run' (visitor::put (#;Some visitor) compiler) body)
+ (#R;Error error)
+ (#R;Error error)
- (#E;Success [compiler' output])
- (#E;Success [(visitor::put (visitor::get compiler) compiler')
+ (#R;Success [compiler' output])
+ (#R;Success [(visitor::put (visitor::get compiler) compiler')
output]))))
diff --git a/new-luxc/source/luxc/compiler/expr.jvm.lux b/new-luxc/source/luxc/compiler/expr.jvm.lux
index 173293b1c..b2e4923c4 100644
--- a/new-luxc/source/luxc/compiler/expr.jvm.lux
+++ b/new-luxc/source/luxc/compiler/expr.jvm.lux
@@ -5,7 +5,8 @@
[macro #+ Monad<Lux> "Lux/" Monad<Lux>]
[host #+ jvm-import])
(luxc ["&" base]
- (lang ["ls" synthesis])
+ (lang ["la" analysis]
+ ["ls" synthesis])
["&;" analyser]
["&;" synthesizer]
(compiler ["&;" common])))
diff --git a/new-luxc/source/luxc/compiler/runtime.jvm.lux b/new-luxc/source/luxc/compiler/runtime.jvm.lux
index 4a5e44785..16e072194 100644
--- a/new-luxc/source/luxc/compiler/runtime.jvm.lux
+++ b/new-luxc/source/luxc/compiler/runtime.jvm.lux
@@ -3,9 +3,9 @@
(lux (control monad)
(concurrency ["P" promise "P/" Monad<Promise>])
(data text/format
- ["E" error]))
+ ["R" result]))
(luxc ["&" base]))
(def: #export (compile-runtime compiler)
- (-> Compiler (P;Promise (E;Error Compiler)))
- (P/wrap (#E;Success compiler)))
+ (-> Compiler (P;Promise (R;Result Compiler)))
+ (P/wrap (#R;Success compiler)))
diff --git a/new-luxc/source/luxc/compiler/statement.jvm.lux b/new-luxc/source/luxc/compiler/statement.jvm.lux
index 7e48d061f..96263181f 100644
--- a/new-luxc/source/luxc/compiler/statement.jvm.lux
+++ b/new-luxc/source/luxc/compiler/statement.jvm.lux
@@ -2,8 +2,7 @@
lux
(lux (control monad)
[io #- run]
- (data ["E" error]
- [text "T/" Eq<Text>]
+ (data [text "T/" Eq<Text>]
text/format)
[macro #+ Monad<Lux>])
(luxc ["&" base]