aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/program.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-10-26 14:48:05 -0400
committerEduardo Julian2017-10-26 14:48:05 -0400
commit1fabe19f7eacb668ef26cccde681dce5e2f98072 (patch)
treead2ead4ae5d7f997353e7b8223aa29725df40111 /new-luxc/source/program.lux
parent40e9eae7468af9b03f6c684171d83a521dd90e82 (diff)
- WIP: Wiring everything to get the compiler to work fully.
- Fixed a bug when combining field/method/class modifiers.
Diffstat (limited to 'new-luxc/source/program.lux')
-rw-r--r--new-luxc/source/program.lux87
1 files changed, 50 insertions, 37 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux
index ecf5cdd6f..3e94c7521 100644
--- a/new-luxc/source/program.lux
+++ b/new-luxc/source/program.lux
@@ -1,40 +1,53 @@
(;module:
lux
- (lux (control monad)
+ (lux (control monad
+ ["p" parser])
+ (concurrency ["P" promise]
+ ["T" task])
+ (data ["e" error])
[io #- run]
- [cli #+ program: CLI Monad<CLI>])
- (luxc ["&" base]
- ["&;" parser]
- ["&;" compiler]
- (module (descriptor ["&;" type]))
- ))
-
-(type: Compilation
- {#program &;Path
- #target &;Path})
-
-(def: (marker tokens)
- (-> (List 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: compilation^
- (CLI Compilation)
- ($_ cli;seq
- (tagged (list "-p" "--program"))
- (tagged (list "-t" "--target"))))
-
-(program: ([command (cli;opt compilation^)]
- [sources (cli;some (tagged (list "-s" "--source")))])
- (case command
- #;None
- (io (log! "No REPL for you!"))
-
- (#;Some [program target])
- (exec (&compiler;compile-program program target sources)
- (io []))))
+ [cli #+ program: CLI])
+ (luxc ["&;" generator]))
+
+## (type: Compilation
+## {#program &;Path
+## #target &;Path})
+
+## (def: (marker tokens)
+## (-> (List 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: compilation^
+## (CLI Compilation)
+## ($_ cli;seq
+## (tagged (list "-p" "--program"))
+## (tagged (list "-t" "--target"))))
+
+## (program: ([command (cli;opt compilation^)]
+## [sources (cli;some (tagged (list "-s" "--source")))])
+## (case command
+## #;None
+## (io (log! "No REPL for you!"))
+
+## (#;Some [program target])
+## (exec (&compiler;compile-program program target sources)
+## (io []))))
+
+(def: (or-crash! action)
+ (All [a] (-> (T;Task a) (P;Promise a)))
+ (do P;Monad<Promise>
+ [?output action]
+ (case ?output
+ (#e;Error error)
+ (error! error)
+
+ (#e;Success output)
+ (wrap output))))
+
+