diff options
Diffstat (limited to 'stdlib/source/lux/compiler/cli.lux')
-rw-r--r-- | stdlib/source/lux/compiler/cli.lux | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/stdlib/source/lux/compiler/cli.lux b/stdlib/source/lux/compiler/cli.lux new file mode 100644 index 000000000..a73eb5a15 --- /dev/null +++ b/stdlib/source/lux/compiler/cli.lux @@ -0,0 +1,53 @@ +(.module: + [lux #* + [control + ["p" parser]] + ["." cli (#+ CLI)] + [world + [file (#+ File)]]]) + +(type: #export Configuration + {#sources (List File) + #target File}) + +(type: #export Build + [Configuration Text]) + +(type: #export REPL + Configuration) + +(type: #export Service + (#Build Build) + (#REPL REPL)) + +(do-template [<name> <short> <long>] + [(def: #export <name> + (CLI Text) + (cli.parameter [<short> <long>]))] + + [source "-s" "--source"] + [target "-t" "--target"] + [program "-p" "--program"] + ) + +(def: #export configuration + (CLI Configuration) + ($_ p.and + (p.some ..source) + ..target)) + +(def: #export build + (CLI Build) + ($_ p.and + configuration + ..program)) + +(def: #export repl + (CLI REPL) + ..configuration) + +(def: #export service + (CLI Service) + ($_ p.or + (p.after (cli.this "build") ..build) + (p.after (cli.this "repl") ..repl))) |