diff options
Diffstat (limited to 'stdlib/source/library')
5 files changed, 144 insertions, 52 deletions
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 55cbe77ba..f13818a4a 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -585,18 +585,18 @@ (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] (in (type.class (name.safe name) parameters)))) -(exception: .public (unexpected_type_variable [name Text - type_vars (List (Type Var))]) +(exception: .public (unknown_type_variable [name Text + type_vars (List (Type Var))]) (exception.report ["Unexpected Type Variable" (%.text name)] ["Expected Type Variables" (exception.listing parser.name type_vars)])) -(def: (variable^ type_vars) +(def: (type_variable options) (-> (List (Type Var)) (Parser (Type Parameter))) (do <>.monad [name <code>.local_symbol - _ (..assertion ..unexpected_type_variable [name type_vars] - (list.member? text.equivalence (list#each parser.name type_vars) name))] + _ (..assertion ..unknown_type_variable [name options] + (list.member? text.equivalence (list#each parser.name options) name))] (in (type.var name)))) (def: wildcard^ @@ -623,7 +623,7 @@ (function (_ _) (let [class^ (..class^' parameter^ type_vars)] ($_ <>.either - (..variable^ type_vars) + (..type_variable type_vars) ..wildcard^ (upper^ class^) (lower^ class^) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index d1962e192..c422dd1c2 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -1,40 +1,40 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}] - [monoid {"+" Monoid}]] - [control - ["[0]" function] - ["[0]" try]] - [data - ["[0]" product] - ["[0]" binary] - ["[0]" format "_" - ["[1]" binary {"+" Mutation Specification}]] - [collection - ["[0]" list]]] - [macro - ["[0]" template]] - [math - [number {"+" hex} - ["n" nat]]] - [type - abstract]]] - ["[0]" // "_" - ["[1][0]" address {"+" Address}] - ["[1][0]" jump {"+" Jump Big_Jump}] - [environment - [limit - [registry {"+" Register}]]] - ["/[1]" // "_" - ["[1][0]" index {"+" Index}] - ["[1][0]" constant {"+" Class Reference}] - [encoding - ["[1][0]" unsigned {"+" U1 U2 U4}] - ["[1][0]" signed {"+" S1 S2 S4}]] - [type - [category {"+" Value Method}]]]]) + [library + [lux "*" + [abstract + [monad {"+" do}] + [monoid {"+" Monoid}]] + [control + ["[0]" function] + ["[0]" try]] + [data + ["[0]" product] + ["[0]" binary] + ["[0]" format "_" + ["[1]" binary {"+" Mutation Specification}]] + [collection + ["[0]" list]]] + [macro + ["[0]" template]] + [math + [number {"+" hex} + ["n" nat]]] + [type + abstract]]] + ["[0]" // "_" + ["[1][0]" address {"+" Address}] + ["[1][0]" jump {"+" Jump Big_Jump}] + [environment + [limit + [registry {"+" Register}]]] + ["/[1]" // "_" + ["[1][0]" index {"+" Index}] + ["[1][0]" constant {"+" Class Reference}] + [encoding + ["[1][0]" unsigned {"+" U1 U2 U4}] + ["[1][0]" signed {"+" S1 S2 S4}]] + [type + [category {"+" Value Method}]]]]) (type: .public Size U2) @@ -60,15 +60,15 @@ (type: Opcode Nat) -(template [<name> <size>] +(template [<size> <name>] [(def: <name> Size (|> <size> ///unsigned.u2 try.trusted))] - [opcode_size 1] - [register_size 1] - [byte_size 1] - [index_size 2] - [big_jump_size 4] - [integer_size 4] + [1 opcode_size] + [1 register_size] + [1 byte_size] + [2 index_size] + [4 big_jump_size] + [4 integer_size] ) (def: (nullary' opcode) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 6d3746721..87864e062 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -194,8 +194,8 @@ ... ..expression (format left_delimiter (|> entries - (list#each entry_serializer) - (text.interposed ", ")) + (list#each (|>> entry_serializer (text.suffix ", "))) + text.together) right_delimiter)))) (template [<name> <pre> <post>] 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))) |