aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/program.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/program.lux')
-rw-r--r--new-luxc/source/program.lux51
1 files changed, 13 insertions, 38 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux
index b1619e830..07f21962b 100644
--- a/new-luxc/source/program.lux
+++ b/new-luxc/source/program.lux
@@ -3,27 +3,16 @@
(lux (control monad)
[io #- run]
[cli #+ program: CLI Monad<CLI>])
- (luxc ["&;" parser]))
-
-(type: Path Text)
-
-(type: Platform
- #JVM
- #JS)
-
-(type: Mode
- #Release
- #Debug)
+ (luxc ["&" base]
+ ["&;" parser]
+ ["&;" compiler]
+ (module (descriptor ["&;" type]))
+ ))
(type: Compilation
- {#mode Mode
- #platform Platform
- #program Path
- #target Path})
-
-(type: Inputs
- {#resources (List Path)
- #sources (List Path)})
+ {#mode &;Mode
+ #program &;Path
+ #target &;Path})
(def: (marker tokens)
(-> (List Text) (CLI Unit))
@@ -36,37 +25,23 @@
cli;any))
(def: mode^
- (CLI Mode)
+ (CLI &;Mode)
($_ cli;alt
(marker (list "release"))
(marker (list "debug"))))
-(def: platform^
- (CLI Platform)
- ($_ cli;alt
- (marker (list "jvm"))
- (marker (list "js"))))
-
(def: compilation^
(CLI Compilation)
($_ cli;seq
mode^
- platform^
(tagged (list "-p" "--program"))
(tagged (list "-t" "--target"))))
-(def: inputs^
- (CLI Inputs)
- ($_ cli;seq
- (cli;some (tagged (list "-r" "--resource")))
- (cli;some (tagged (list "-s" "--source")))))
-
-(program: ([[command [resources sources]]
- (cli;seq (cli;opt compilation^)
- inputs^)])
+(program: ([command (cli;opt compilation^)]
+ [sources (cli;some (tagged (list "-s" "--source")))])
(case command
#;None
(io (log! "Hello, REPL!"))
- (#;Some [mode platform program target])
- (io (log! "Hello, compilation!"))))
+ (#;Some [mode program target])
+ (&compiler;compile-program mode program target sources)))