diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/program.lux | 87 |
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)))) + + |