diff options
Diffstat (limited to 'stdlib/source/documentation/lux/meta')
7 files changed, 569 insertions, 7 deletions
diff --git a/stdlib/source/documentation/lux/meta/code.lux b/stdlib/source/documentation/lux/meta/code.lux index df50d5049..d1bf31f01 100644 --- a/stdlib/source/documentation/lux/meta/code.lux +++ b/stdlib/source/documentation/lux/meta/code.lux @@ -1,15 +1,88 @@ (.require [library - [lux (.except char local global) + [lux (.except) ["$" documentation] [data - [text + [text (.only \n) ["%" \\format (.only format)]] [collection - ["[0]" list]]]]] + ["[0]" list]]] + [meta + [macro + ["[0]" template]]]]] + ["[0]" \\parser] [\\library ["[0]" /]]) +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.documentation (\\parser.Parser it) + "A Lux code parser.") + + ($.documentation \\parser.any + "Yields the next input without applying any logic.") + + (,, (with_template [<query> <check>] + [(`` ($.documentation <query> + (format "Parses the next " (,, (template.text [<query>])) " input."))) + (`` ($.documentation <check> + (format "Checks for a specific " (,, (template.text [<query>])) " input.")))] + + [\\parser.bit \\parser.this_bit] + [\\parser.nat \\parser.this_nat] + [\\parser.int \\parser.this_int] + [\\parser.rev \\parser.this_rev] + [\\parser.frac \\parser.this_frac] + [\\parser.text \\parser.this_text] + [\\parser.symbol \\parser.this_symbol] + )) + + ($.documentation \\parser.this + "Ensures the given Code is the next input." + [(this code)]) + + (,, (with_template [<query> <check> <desc>] + [($.documentation <query> + (format "Parse a local " <desc> " (a " <desc> " that has no module prefix).")) + ($.documentation <check> + (format "Checks for a specific local " <desc> " (a " <desc> " that has no module prefix)."))] + + [\\parser.local \\parser.this_local "local symbol"] + )) + + (,, (with_template [<name>] + [(`` ($.documentation <name> + (format "Parses the contents of a " (,, (template.text [<name>])) ".")))] + + [\\parser.form] + [\\parser.variant] + [\\parser.tuple] + )) + + ($.documentation \\parser.end + "Verifies there are no more inputs.") + + ($.documentation \\parser.end? + "Checks whether there are no more inputs.") + + ($.documentation \\parser.result + "Executes a parser against a stream of code, and verifies all the inputs are consumed." + [(result parser inputs)]) + + ($.documentation \\parser.locally + "Runs parser against the given list of inputs." + [(locally inputs parser)]) + + ($.documentation \\parser.not + "Yields the next Code token if the parser fails." + [(not expected_to_fail)]) + + ($.documentation \\parser.next + "Yields the next Code token without consuming it from the input stream.")] + []))) + (.def .public documentation (.List $.Module) ($.module /._ @@ -34,4 +107,4 @@ ($.documentation /.replaced "" [(replaced original substitute ast)])] - [])) + [..\\parser])) diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux new file mode 100644 index 000000000..7daade0e8 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/analysis.lux @@ -0,0 +1,109 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] + [meta + [macro + ["[0]" template]]]]] + ["[0]" \\parser] + [\\library + ["[0]" /]]) + +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.cannot_parse) + ($.default \\parser.unconsumed_input) + + ($.documentation (\\parser.Parser it) + "A parser for Lux code analysis nodes.") + + ($.documentation \\parser.result + "Executes a parser and makes sure no inputs go unconsumed." + [(result parser input)]) + + ($.documentation \\parser.any + "Matches any value, without discrimination.") + + ($.documentation \\parser.end + "Ensures there are no more inputs.") + + ($.documentation \\parser.end? + "Checks whether there are no more inputs.") + + (,, (with_template [<query> <assertion>] + [($.documentation <query> + (format "Queries for a " (template.text [<query>]) " value.")) + ($.documentation <assertion> + (format "Assert a specific " (template.text [<query>]) " value."))] + + [\\parser.bit \\parser.this_bit] + [\\parser.nat \\parser.this_nat] + [\\parser.int \\parser.this_int] + [\\parser.rev \\parser.this_rev] + [\\parser.frac \\parser.this_frac] + [\\parser.text \\parser.this_text] + [\\parser.local \\parser.this_local] + [\\parser.foreign \\parser.this_foreign] + [\\parser.constant \\parser.this_constant] + )) + + ($.documentation \\parser.tuple + "Parses only within the context of a tuple's contents." + [(tuple parser)])] + []))) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Branch') + ($.default /.Match') + ($.default /.Environment) + ($.default /.Analysis) + ($.default /.Branch) + ($.default /.Match) + ($.default /.equivalence) + ($.default /.case) + ($.default /.unit) + ($.default /.bit) + ($.default /.nat) + ($.default /.int) + ($.default /.rev) + ($.default /.frac) + ($.default /.text) + ($.default /.no_op) + ($.default /.variable) + ($.default /.constant) + ($.default /.local) + ($.default /.foreign) + ($.default /.variant) + ($.default /.tuple) + ($.default /.format) + ($.default /.State+) + ($.default /.Operation) + ($.default /.Phase) + ($.default /.Handler) + ($.default /.Bundle) + ($.default /.with_source_code) + ($.default /.with_current_module) + ($.default /.with_location) + ($.default /.failure) + ($.default /.except) + ($.default /.assertion) + ($.default /.with_exception) + ($.default /.set_state) + ($.default /.set_source_code) + ($.default /.set_current_module) + ($.default /.set_location) + ($.default /.location) + ($.default /.source) + ($.default /.info) + ($.default /.state)] + [..\\parser])) diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/declaration.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/declaration.lux new file mode 100644 index 000000000..cc2088576 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/declaration.lux @@ -0,0 +1,35 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Component) + ($.default /.State) + ($.default /.Import) + ($.default /.Requirements) + ($.default /.no_requirements) + ($.default /.merge_requirements) + ($.default /.State+) + ($.default /.Operation) + ($.default /.Phase) + ($.default /.Handler) + ($.default /.Bundle) + ($.default /.analysis) + ($.default /.synthesis) + ($.default /.generation) + ($.default /.lifted_analysis) + ($.default /.lifted_synthesis) + ($.default /.lifted_generation) + ($.default /.set_current_module)] + [])) diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/generation.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/generation.lux new file mode 100644 index 000000000..295ada218 --- /dev/null +++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/generation.lux @@ -0,0 +1,63 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Buffer) + ($.default /.cannot_interpret) + ($.default /.cannot_overwrite_output) + ($.default /.no_buffer_for_saving_code) + ($.default /.Host) + ($.default /.State) + ($.default /.State+) + ($.default /.Operation) + ($.default /.Phase) + ($.default /.Handler) + ($.default /.Bundle) + ($.default /.Extender) + ($.default /.state) + ($.default /.empty_buffer) + ($.default /.with_anchor) + ($.default /.set_anchor) + ($.default /.anchor) + ($.default /.no_anchor) + ($.default /.with_buffer) + ($.default /.set_buffer) + ($.default /.buffer) + ($.default /.no_active_buffer) + ($.default /.get_registry) + ($.default /.set_registry) + ($.default /.next) + ($.default /.symbol) + ($.default /.enter_module) + ($.default /.module) + ($.default /.evaluate!) + ($.default /.execute!) + ($.default /.define!) + ($.default /.save!) + ($.default /.learn) + ($.default /.learn_custom) + ($.default /.learn_analyser) + ($.default /.learn_synthesizer) + ($.default /.learn_generator) + ($.default /.learn_declaration) + ($.default /.unknown_definition) + ($.default /.remember) + ($.default /.no_context) + ($.default /.module_id) + ($.default /.context) + ($.default /.with_context) + ($.default /.with_new_context) + ($.default /.log!)] + [])) diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux new file mode 100644 index 000000000..dcfe3ce0a --- /dev/null +++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/synthesis.lux @@ -0,0 +1,142 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] + [meta + [macro + ["[0]" template]]]]] + ["[0]" \\parser] + [\\library + ["[0]" /]]) + +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.cannot_parse) + ($.default \\parser.unconsumed_input) + ($.default \\parser.expected_empty_input) + ($.default \\parser.wrong_arity) + ($.default \\parser.empty_input) + + ($.documentation (\\parser.Parser it) + "A parser for the Lux compiler's synthesis nodes using during optimization.") + + ($.documentation \\parser.result + (format "Executes the parser against the inputs." + \n "Ensures all inputs are consumed by the parser.") + [(result parser input)]) + + ($.documentation \\parser.any + "Yields a synthesis node without subjecting it to any analysis.") + + ($.documentation \\parser.end + "Ensures there are no more inputs.") + + ($.documentation \\parser.end? + "Checks whether there are no more inputs.") + + (,, (with_template [<query> <assertion>] + [($.documentation <query> + (format "Queries for a " (template.text [<query>]) " synthesis node.")) + ($.documentation <assertion> + (format "Checks for a specific " (template.text [<query>]) " synthesis node."))] + + [\\parser.bit \\parser.this_bit] + [\\parser.i64 \\parser.this_i64] + [\\parser.f64 \\parser.this_f64] + [\\parser.text \\parser.this_text] + [\\parser.local \\parser.this_local] + [\\parser.foreign \\parser.this_foreign] + [\\parser.constant \\parser.this_constant] + )) + + ($.documentation \\parser.tuple + "Parses the contents of a tuple." + [(tuple parser)]) + + ($.documentation \\parser.function + "Parses the body of a function with the 'expected' arity." + [(function expected parser)]) + + ($.documentation \\parser.loop + "Parses the initial values and the body of a loop." + [(loop init_parsers iteration_parser)])] + []))) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Resolver) + ($.default /.State) + ($.default /.fresh_resolver) + ($.default /.init) + ($.default /.Fork) + ($.default /.Path') + ($.default /.Abstraction') + ($.default /.Apply') + ($.default /.Branch) + ($.default /.Scope) + ($.default /.Loop) + ($.default /.Function) + ($.default /.Control) + ($.default /.Synthesis) + ($.default /.State+) + ($.default /.Operation) + ($.default /.Phase) + ($.default /.Handler) + ($.default /.Bundle) + ($.default /.Path) + ($.default /.path/pop) + ($.default /.path/side) + ($.default /.path/member) + ($.default /.side/left) + ($.default /.side/right) + ($.default /.member/left) + ($.default /.member/right) + ($.default /.path/bind) + ($.default /.path/then) + ($.default /.path/alt) + ($.default /.path/seq) + ($.default /.Abstraction) + ($.default /.Apply) + ($.default /.unit) + ($.default /.with_locals) + ($.default /.locals) + ($.default /.with_currying?) + ($.default /.currying?) + ($.default /.with_new_local) + ($.default /.bit) + ($.default /.i64) + ($.default /.f64) + ($.default /.text) + ($.default /.variant) + ($.default /.tuple) + ($.default /.variable) + ($.default /.constant) + ($.default /.variable/local) + ($.default /.variable/foreign) + ($.default /.branch/case) + ($.default /.branch/let) + ($.default /.branch/if) + ($.default /.branch/get) + ($.default /.loop/again) + ($.default /.loop/scope) + ($.default /.function/abstraction) + ($.default /.function/apply) + ($.default /.%path') + ($.default /.%synthesis) + ($.default /.%path) + ($.default /.equivalence) + ($.default /.hash) + ($.default /.!bind_top) + ($.default /.!multi_pop) + ($.default /.simple_left_side) + ($.default /.simple_right_side)] + [..\\parser])) diff --git a/stdlib/source/documentation/lux/meta/compiler/phase.lux b/stdlib/source/documentation/lux/meta/compiler/phase.lux new file mode 100644 index 000000000..5efcf5d0f --- /dev/null +++ b/stdlib/source/documentation/lux/meta/compiler/phase.lux @@ -0,0 +1,32 @@ +(.require + [library + [lux (.except char) + ["$" documentation] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Operation) + ($.default /.monad) + ($.default /.Phase) + ($.default /.Wrapper) + ($.default /.result') + ($.default /.result) + ($.default /.state) + ($.default /.with) + ($.default /.sub) + ($.default /.failure) + ($.default /.except) + ($.default /.lifted) + ($.default /.assertion) + ($.default /.identity) + ($.default /.composite)] + [])) diff --git a/stdlib/source/documentation/lux/meta/type.lux b/stdlib/source/documentation/lux/meta/type.lux index 541e3978c..f2335eb24 100644 --- a/stdlib/source/documentation/lux/meta/type.lux +++ b/stdlib/source/documentation/lux/meta/type.lux @@ -1,10 +1,14 @@ (.require [library - [lux (.except function as let) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) - ["%" \\format]]]]] + ["%" \\format (.only format)]]] + [meta + [macro + ["[0]" template]]]]] + ["[0]" \\parser] [\\library ["[0]" /]] ["[0]" / @@ -19,6 +23,108 @@ ["[1][0]" unit] ["[1][0]" variance]]) +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + (format "Parsing of Lux types." + \n "Used mostly for polytypic programming.") + [($.default \\parser.not_existential) + ($.default \\parser.not_recursive) + ($.default \\parser.not_named) + ($.default \\parser.not_parameter) + ($.default \\parser.unknown_parameter) + ($.default \\parser.not_function) + ($.default \\parser.not_application) + ($.default \\parser.not_polymorphic) + ($.default \\parser.not_variant) + ($.default \\parser.not_tuple) + ($.default \\parser.types_do_not_match) + ($.default \\parser.wrong_parameter) + ($.default \\parser.empty_input) + ($.default \\parser.unconsumed_input) + ($.default \\parser.parameter) + ($.default \\parser.recursive_self) + ($.default \\parser.recursive_call) + + ($.documentation \\parser.Env + "An environment for type parsing.") + + ($.documentation (\\parser.Parser it) + "A parser of Lux types.") + + ($.documentation \\parser.fresh + "An empty parsing environment.") + + ($.documentation \\parser.result + (format "Applies a parser against a type." + \n "Verifies that the parser fully consumes the type's information.") + [(result poly type)]) + + ($.documentation \\parser.env + "Yields the current parsing environment.") + + ($.documentation \\parser.next + "Inspect a type in the input stream without consuming it.") + + ($.documentation \\parser.any + "Yields a type, without examination.") + + ($.documentation \\parser.local + "Apply a parser to the given inputs." + [(local types poly)]) + + ($.documentation \\parser.with_extension + "" + [(with_extension type poly)]) + + (,, (with_template [<name>] + [(`` ($.documentation <name> + (format "Parses the contents of a " (,, (template.text [<name>])) " type.")))] + + [\\parser.variant] + [\\parser.tuple] + )) + + ($.documentation \\parser.polymorphic + "" + [(polymorphic poly)]) + + ($.documentation \\parser.function + "Parses a function's inputs and output." + [(function in_poly out_poly)]) + + ($.documentation \\parser.applied + "Parses a type application." + [(applied poly)]) + + (,, (with_template [<name> <doc>] + [($.documentation <name> + <doc>)] + + [\\parser.exactly "Parses a type exactly."] + [\\parser.sub "Parses a sub type."] + [\\parser.super "Parses a super type."] + )) + + ($.documentation \\parser.argument + "" + [(argument env idx)]) + + ($.documentation \\parser.this_parameter + "" + [(this_parameter id)]) + + ($.documentation \\parser.existential + "Yields an existential type.") + + ($.documentation \\parser.named + "Yields a named type.") + + ($.documentation \\parser.recursive + "" + [(recursive poly)])] + []))) + (`` (.def .public documentation (.List $.Module) ($.module /._ @@ -153,7 +259,9 @@ "Local bindings for types." [(let [side (Either Int Frac)] (List [side side]))])] - [/primitive.documentation + [..\\parser + + /primitive.documentation /check.documentation /dynamic.documentation /implicit.documentation |