aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler
diff options
context:
space:
mode:
authorEduardo Julian2022-02-05 14:51:37 -0400
committerEduardo Julian2022-02-05 14:51:37 -0400
commit54bb56a07e6d8f1e76bd447436fb721a74f09f66 (patch)
treefd3d5699ce5d7546a92f4328dee496ab6ca86aed /stdlib/source/library/lux/tool/compiler
parente4bc4d0e2cd14a955530160c4fc7859e6c46874e (diff)
Updated copyright notices.
Diffstat (limited to 'stdlib/source/library/lux/tool/compiler')
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli.lux92
2 files changed, 93 insertions, 1 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 668daffc5..dc9ff4533 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -49,6 +49,7 @@
[phase
["[0]" extension {"+" Extender}]]]]
[meta
+ [cli {"+" Compilation Library}]
["[0]" archive {"+" Output Archive}
["[0]" registry {"+" Registry}]
["[0]" artifact]
@@ -60,7 +61,6 @@
["ioW" archive]]]]]
[program
[compositor
- [cli {"+" Compilation Library}]
[import {"+" Import}]
["[0]" static {"+" Static}]]])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
new file mode 100644
index 000000000..c4d5eb819
--- /dev/null
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
@@ -0,0 +1,92 @@
+(.using
+ [library
+ [lux {"-" Module Source}
+ [control
+ [pipe {"+" case>}]
+ ["<>" parser
+ ["<[0]>" cli {"+" Parser}]]]
+ [tool
+ [compiler
+ [meta
+ [archive
+ [module
+ ["[0]" descriptor]]]]]]
+ [world
+ [file {"+" Path}]]]])
+
+(type: .public Source
+ Path)
+
+(type: .public Host_Dependency
+ Path)
+
+(type: .public Library
+ Path)
+
+(type: .public Target
+ Path)
+
+(type: .public Module
+ descriptor.Module)
+
+(type: .public Compilation
+ (Record
+ [#sources (List Source)
+ #host_dependencies (List Host_Dependency)
+ #libraries (List Library)
+ #target Target
+ #module Module]))
+
+(type: .public Interpretation
+ ..Compilation)
+
+(type: .public Export
+ [(List Source) Target])
+
+(type: .public Service
+ (Variant
+ {#Compilation Compilation}
+ {#Interpretation Interpretation}
+ {#Export Export}))
+
+(template [<name> <long> <type>]
+ [(def: <name>
+ (Parser <type>)
+ (<cli>.named <long> <cli>.any))]
+
+ [source_parser "--source" Source]
+ [host_dependency_parser "--host_dependency" Host_Dependency]
+ [library_parser "--library" Library]
+ [target_parser "--target" Target]
+ [module_parser "--module" Module]
+ )
+
+(def: .public service
+ (Parser Service)
+ ($_ <>.or
+ (<>.after (<cli>.this "build")
+ ($_ <>.and
+ (<>.some ..source_parser)
+ (<>.some ..host_dependency_parser)
+ (<>.some ..library_parser)
+ ..target_parser
+ ..module_parser))
+ (<>.after (<cli>.this "repl")
+ ($_ <>.and
+ (<>.some ..source_parser)
+ (<>.some ..host_dependency_parser)
+ (<>.some ..library_parser)
+ ..target_parser
+ ..module_parser))
+ (<>.after (<cli>.this "export")
+ ($_ <>.and
+ (<>.some ..source_parser)
+ ..target_parser))
+ ))
+
+(def: .public target
+ (-> Service Target)
+ (|>> (case> (^or {#Compilation [sources host_dependencies libraries target module]}
+ {#Interpretation [sources host_dependencies libraries target module]}
+ {#Export [sources target]})
+ target)))