aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
authorEduardo Julian2017-04-14 17:36:40 -0400
committerEduardo Julian2017-04-14 17:36:40 -0400
commit72482573b97662b6b5910213b5f1bf21c685961c (patch)
tree045a3310d94dc9cc2fb67ef5adc770df33494f98 /new-luxc/source
parent079fdb6c828bd7589ba0785ad1bb82c14b375f32 (diff)
- Development of the new re-written compiler has officially begun!
Diffstat (limited to 'new-luxc/source')
-rw-r--r--new-luxc/source/program.lux71
1 files changed, 71 insertions, 0 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux
new file mode 100644
index 000000000..dbe875d12
--- /dev/null
+++ b/new-luxc/source/program.lux
@@ -0,0 +1,71 @@
+(;module:
+ lux
+ (lux (control monad)
+ [io #- run]
+ [cli #+ program: CLI Monad<CLI>]))
+
+(type: Path Text)
+
+(type: Platform
+ #JVM
+ #JS)
+
+(type: Mode
+ #Release
+ #Debug)
+
+(type: Compilation
+ {#mode Mode
+ #platform Platform
+ #program Path
+ #target Path})
+
+(type: Inputs
+ {#resources (List Path)
+ #sources (List Path)})
+
+(def: (marker tokens)
+ (-> Text (CLI Unit))
+ (cli;after (cli;option tokens)
+ (:: Monad<CLI> wrap [])))
+
+(def: (tagged tags)
+ (-> (List Text) (CLI Text))
+ (cli;after (cli;option tags)
+ cli;any))
+
+(def: 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^)])
+ (case command
+ #;None
+ (io (log! "Hello, REPL!"))
+
+ (#;Some [mode platform program target])
+ (io (log! "Hello, compilation!"))))