diff options
author | Eduardo Julian | 2019-02-24 12:26:17 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-02-24 12:26:17 -0400 |
commit | a72e34d30eaf3557f9b76ced9605a95759ce8eca (patch) | |
tree | 5fd88f66ac3b2b0abb5561521f806afb93c5134e /new-luxc/source/program.lux | |
parent | 950ac7c3311ad8ff4499164a30610fca2e57d5c9 (diff) |
Got new-luxc to compile/build again.
Diffstat (limited to 'new-luxc/source/program.lux')
-rw-r--r-- | new-luxc/source/program.lux | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux index 4fa032f7f..cee627708 100644 --- a/new-luxc/source/program.lux +++ b/new-luxc/source/program.lux @@ -1,19 +1,19 @@ (.module: [lux #* + [cli (#+ program:)] [control [monad (#+ do)]] [data - ["." error] + ["." error (#+ Error)] ["." text format]] - ["." io (#+ IO Process io)] + ["." io (#+ IO io)] [time - ["." instant]] - [cli (#+ program:)] + ["." instant (#+ Instant)]] [world ["." file (#+ File)] ["." console]] - [platform + [tool ["." compiler ["." cli (#+ Configuration)] [meta @@ -26,9 +26,9 @@ [default ["." platform (#+ Platform)] ["." init] - ["." syntax]]]] - ## ["." interpreter] - ] + ["." syntax]]] + ## ["." interpreter] + ]] [luxc [lang ["." host/jvm] @@ -41,11 +41,11 @@ (def: (or-crash! failure-description action) (All [a] - (-> Text (Process a) (IO a))) - (do io.Monad<IO> + (-> Text (IO (Error a)) (IO a))) + (do io.monad [?output action] (case ?output - (#error.Error error) + (#error.Failure error) (exec (log! (format text.new-line failure-description text.new-line error text.new-line)) @@ -56,38 +56,44 @@ (def: (timed action) (All [a] - (-> (-> Any (Process a)) (Process a))) - (do io.Monad<Process> - [start (io.from-io instant.now) + (-> (-> Any (IO (Error a))) (IO (Error a)))) + (do (error.with-error io.monad) + [start (: (IO (Error Instant)) + (error.lift io.monad instant.now)) result (action []) - finish (io.from-io instant.now) + finish (: (IO (Error Instant)) + (error.lift io.monad instant.now)) #let [elapsed-time (instant.span start finish) _ (log! (format text.new-line "Elapsed time: " (%duration elapsed-time)))]] (wrap result))) (def: jvm-platform - (IO (Platform Process host/jvm.Anchor host/jvm.Inst host/jvm.Definition)) - (do io.Monad<IO> + (IO (Platform IO host/jvm.Anchor host/jvm.Inst host/jvm.Definition)) + (do io.monad [host jvm.init] - (wrap {#platform.host host + (wrap {#platform.&monad io.monad + #platform.&file-system file.system + #platform.host host #platform.phase expression.translate - #platform.runtime runtime.translate - #platform.file-system file.JVM@System}))) + #platform.runtime runtime.translate}))) (program: [{service cli.service}] - (do io.Monad<IO> - [platform ..jvm-platform - console (:: @ map error.assume console.open)] + (do io.monad + [platform (: (IO (Platform IO host/jvm.Anchor host/jvm.Inst host/jvm.Definition)) + ..jvm-platform) + console (:: @ map error.assume console.system)] (case service (#cli.Compilation configuration) (<| (or-crash! "Compilation failed:") ..timed (function (_ _) - (do (:: (get@ #platform.file-system platform) &monad) - [state (platform.initialize platform common.bundle) - _ (platform.compile platform (set@ #cli.module syntax.prelude configuration) state) - ## _ (compile platform configuration state) + (do (error.with-error io.monad) + [state (: (IO (Error (statement.State+ host/jvm.Anchor host/jvm.Inst host/jvm.Definition))) + (platform.initialize platform common.bundle)) + ## _ (platform.compile platform (set@ #cli.module syntax.prelude configuration) state) + _ (: (IO (Error Any)) + (platform.compile platform configuration state)) ## _ (cache/io.clean target ...) ] (wrap (log! "Compilation complete!"))))) @@ -96,5 +102,5 @@ ## TODO: Fix the interpreter... (undefined) ## (<| (or-crash! "Interpretation failed:") - ## (interpreter.run io.Monad<Process> console platform configuration common.bundle)) + ## (interpreter.run (error.with-error io.monad) console platform configuration common.bundle)) ))) |