aboutsummaryrefslogtreecommitdiff
path: root/new-luxc
diff options
context:
space:
mode:
authorEduardo Julian2018-10-27 20:02:08 -0400
committerEduardo Julian2018-10-27 20:02:08 -0400
commit5a1ea36c5ae4ccc990c77ff9a984468473384c0c (patch)
tree998b1a026fee53e87fac287547a7ab55c9647dd7 /new-luxc
parent90c488db21662f5176cae0d19060ee4eb71bbbd5 (diff)
Some refactoring.
Diffstat (limited to 'new-luxc')
-rw-r--r--new-luxc/source/program.lux53
1 files changed, 37 insertions, 16 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux
index ebc94cacb..0362d14b0 100644
--- a/new-luxc/source/program.lux
+++ b/new-luxc/source/program.lux
@@ -1,8 +1,7 @@
(.module:
[lux #*
[control
- [monad (#+ do)]
- ["p" parser]]
+ [monad (#+ do)]]
[data
["." error]
["." text
@@ -14,10 +13,21 @@
[world
["." file (#+ File)]
["." console]]
- [compiler
- ["." cli]
- ["." default (#+ Platform)]]
- ["." interpreter]]
+ ["." compiler
+ ["." cli (#+ Configuration)]
+ [meta
+ ["." archive]
+ [io
+ ["." context]]]
+ [default
+ ["." platform (#+ Platform)]
+ ["." init]
+ ["." syntax]
+ ["." phase
+ ["." translation]
+ ["." statement]]]]
+ ## ["." interpreter]
+ ]
[luxc
[lang
["." host/jvm]
@@ -45,23 +55,24 @@
(def: (timed action)
(All [a]
- (-> (Process a) (Process a)))
+ (-> (-> Any (Process a)) (Process a)))
(do io.Monad<Process>
[start (io.from-io instant.now)
- result action
+ result (action [])
finish (io.from-io instant.now)
#let [elapsed-time (instant.span start finish)
- _ (log! (format text.new-line "Elapsed time: " (%duration elapsed-time)))]]
+ _ (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>
[host jvm.init]
- (wrap {#default.host host
- #default.phase expression.translate
- #default.runtime runtime.translate
- #default.file-system file.JVM@System})))
+ (wrap {#platform.host host
+ #platform.phase expression.translate
+ #platform.runtime runtime.translate
+ #platform.file-system file.JVM@System})))
(program: [{service cli.service}]
(do io.Monad<IO>
@@ -71,8 +82,18 @@
(#cli.Compilation configuration)
(<| (or-crash! "Compilation failed:")
..timed
- (default.compile platform configuration common.bundle))
+ (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)
+ ## _ (cache/io.clean target ...)
+ ]
+ (wrap (log! "Compilation complete!")))))
(#cli.Interpretation configuration)
- (<| (or-crash! "Interpretation failed:")
- (interpreter.run io.Monad<Process> console platform configuration)))))
+ ## TODO: Fix the interpreter...
+ (undefined)
+ ## (<| (or-crash! "Interpretation failed:")
+ ## (interpreter.run io.Monad<Process> console platform configuration common.bundle))
+ )))