diff options
author | Eduardo Julian | 2022-06-26 19:37:45 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-26 19:37:45 -0400 |
commit | 853d28f803e75d125915a81dcdcd140513efe3d2 (patch) | |
tree | 41d24b6cb5593b631793efa77f53359e8229ea37 | |
parent | 9f6505491e8a5c8a159ce094fe0af6f4fef0c5cf (diff) |
Re-named directives to declarations.
86 files changed, 2363 insertions, 3007 deletions
diff --git a/lux-bootstrapper/src/lux/analyser/lux.clj b/lux-bootstrapper/src/lux/analyser/lux.clj index 6f7b747c1..23f6cf4fa 100644 --- a/lux-bootstrapper/src/lux/analyser/lux.clj +++ b/lux-bootstrapper/src/lux/analyser/lux.clj @@ -578,7 +578,7 @@ (eval! (optimize analysis)))) (defn analyse-def* [analyse optimize eval! compile-def ?name ?value exported? type? & [?expected-type]] - (|do [_ &/ensure-directive + (|do [_ &/ensure-declaration module-name &/get-module-name _ (ensure-undefined! module-name ?name) =value (&/without-repl-closure @@ -684,7 +684,7 @@ (deliver (&/$Right _compiler)))))))) (defn analyse-module [analyse optimize eval! compile-module ?imports] - (|do [_ &/ensure-directive + (|do [_ &/ensure-declaration module-name &/get-module-name _imports (&&module/fetch-imports ?imports) current-module &/get-module-name @@ -741,7 +741,7 @@ (let [program-type (&/$Function (&/$Apply &type/Text &type/List) (&/$Apply &type/Any &type/IO))] (defn analyse-program [analyse optimize compile-program ?program] - (|do [_ &/ensure-directive + (|do [_ &/ensure-declaration =program (&&/analyse-1 analyse program-type ?program) _ (compile-program (optimize =program))] (return &/$End)))) diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj index 88f06d928..d0c457680 100644 --- a/lux-bootstrapper/src/lux/base.clj +++ b/lux-bootstrapper/src/lux/base.clj @@ -478,7 +478,7 @@ ($Item head tail)) ($Item (T [slot value]) $End) prefix) - + ($Item [k v] input*) (if (= k slot) (fold (fn [tail head] @@ -487,7 +487,7 @@ prefix) (recur ($Item (T [k v]) prefix) input*)) - ))) + ))) (defmacro |table [& elems] (reduce (fn [table [k v]] @@ -1115,14 +1115,14 @@ output)))))) (def ^{:doc "(Meta Any)"} - ensure-directive + ensure-declaration (fn [state] (|case (get$ $expected state) ($None) (return* state unit-tag) ($Some _) - ((fail-with-loc "[Error] All directives must be top-level forms.") + ((fail-with-loc "[Error] All declarations must be top-level forms.") state)))) (def location diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index 977c00f16..8d9dcdb1c 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -47,7 +47,7 @@ ["[1]" jvm]] ["[0]" generation ["[1]" jvm]] - ["[0]" directive + ["[0]" declaration ["[1]" jvm]]] [generation ["/" jvm (.only) @@ -175,7 +175,7 @@ (analysis.bundle loader host) (io.io platform) generation.bundle - (|>> ..extender (directive.bundle loader)) + (|>> ..extender (declaration.bundle loader)) (/program.program /runtime.class_name) [Anchor (type_literal (Bytecode Any)) Definition] ..extender diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index b9c0333ec..f3b36dd27 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -394,7 +394,7 @@ Called by `imenu--generic-function'." (function-application (altRE "|>" "<|" "left" "right" "all")) (function-definition (altRE "function" "|>>" "<<|")) (remember (altRE "remember" "to_do" "fix_me")) - (extension (altRE "analysis" "synthesis" "generation" "directive")) + (extension (altRE "analysis" "synthesis" "generation" "declaration")) (definition (altRE "\\.require" "def" "inlined" "type" "program:" "macro" "syntax" @@ -589,10 +589,11 @@ This function also returns nil meaning don't specify the indentation." ("inlined" 'defun) ("context" 'defun) ("primitive" 'defun) + ("analysis" 'defun) ("synthesis" 'defun) ("generation" 'defun) - ("directive" 'defun) + ("declaration" 'defun) ("class" 'defun) ("interface" 'defun) diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux index 475d07a00..80e05d511 100644 --- a/stdlib/source/documentation/lux/data/binary.lux +++ b/stdlib/source/documentation/lux/data/binary.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,82 +10,68 @@ [\\library ["[0]" /]]) -(documentation: /.Binary - "A binary BLOB of data.") +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.index_out_of_bounds) + ($.default /.slice_out_of_bounds) + ($.default /.size) + ($.default /.equivalence) + ($.default /.monoid) -(documentation: /.empty - "A fresh/empty binary BLOB of the specified size." - [(empty size)]) + ($.documentation /.Binary + "A binary BLOB of data.") -(documentation: /.mix - "" - [(mix f init binary)]) + ($.documentation /.empty + "A fresh/empty binary BLOB of the specified size." + [(empty size)]) -(documentation: /.bits_8 - "Read 1 byte (8 bits) at the given index." - [(bits_8 index binary)]) + ($.documentation /.mix + "" + [(mix f init binary)]) -(documentation: /.bits_16 - "Read 2 bytes (16 bits) at the given index." - [(bits_16 index binary)]) + ($.documentation /.bits_8 + "Read 1 byte (8 bits) at the given index." + [(bits_8 index binary)]) -(documentation: /.bits_32 - "Read 4 bytes (32 bits) at the given index." - [(bits_32 index binary)]) + ($.documentation /.bits_16 + "Read 2 bytes (16 bits) at the given index." + [(bits_16 index binary)]) -(documentation: /.bits_64 - "Read 8 bytes (64 bits) at the given index." - [(bits_64 index binary)]) + ($.documentation /.bits_32 + "Read 4 bytes (32 bits) at the given index." + [(bits_32 index binary)]) -(documentation: /.has_8! - "Write 1 byte (8 bits) at the given index." - [(has_8! index value binary)]) + ($.documentation /.bits_64 + "Read 8 bytes (64 bits) at the given index." + [(bits_64 index binary)]) -(documentation: /.has_16! - "Write 2 bytes (16 bits) at the given index." - [(has_16! index value binary)]) + ($.documentation /.has_8! + "Write 1 byte (8 bits) at the given index." + [(has_8! index value binary)]) -(documentation: /.has_32! - "Write 4 bytes (32 bits) at the given index." - [(has_32! index value binary)]) + ($.documentation /.has_16! + "Write 2 bytes (16 bits) at the given index." + [(has_16! index value binary)]) -(documentation: /.has_64! - "Write 8 bytes (64 bits) at the given index." - [(has_64! index value binary)]) + ($.documentation /.has_32! + "Write 4 bytes (32 bits) at the given index." + [(has_32! index value binary)]) -(documentation: /.copy! - "Mutates the target binary BLOB by copying bytes from the source BLOB to it." - [(copy! bytes source_offset source target_offset target)]) + ($.documentation /.has_64! + "Write 8 bytes (64 bits) at the given index." + [(has_64! index value binary)]) -(documentation: /.slice - "Yields a subset of the binary BLOB, so long as the specified range is valid." - [(slice offset length binary)]) + ($.documentation /.copy! + "Mutates the target binary BLOB by copying bytes from the source BLOB to it." + [(copy! bytes source_offset source target_offset target)]) -(documentation: /.after - "Yields a binary BLOB with at most the specified number of bytes removed." - [(after bytes binary)]) + ($.documentation /.slice + "Yields a subset of the binary BLOB, so long as the specified range is valid." + [(slice offset length binary)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Binary - ..empty - ..mix - ..bits_8 - ..bits_16 - ..bits_32 - ..bits_64 - ..has_8! - ..has_16! - ..has_32! - ..has_64! - ..copy! - ..slice - ..after - ($.default /.index_out_of_bounds) - ($.default /.slice_out_of_bounds) - ($.default /.size) - ($.default /.equivalence) - ($.default /.monoid)] + ($.documentation /.after + "Yields a binary BLOB with at most the specified number of bytes removed." + [(after bytes binary)])] [])) diff --git a/stdlib/source/documentation/lux/data/bit.lux b/stdlib/source/documentation/lux/data/bit.lux index 8895a4803..43d64ae46 100644 --- a/stdlib/source/documentation/lux/data/bit.lux +++ b/stdlib/source/documentation/lux/data/bit.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,16 +10,11 @@ [\\library ["[0]" /]]) -(documentation: /.complement - (format "Generates the complement of a predicate." - \n "That is a predicate that returns the oposite of the original predicate.")) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..complement - ($.default /.no) + [($.default /.no) ($.default /.yes) ($.default /.off) ($.default /.on) @@ -27,5 +22,9 @@ ($.default /.hash) ($.default /.disjunction) ($.default /.conjunction) - ($.default /.codec)] + ($.default /.codec) + + ($.documentation /.complement + (format "Generates the complement of a predicate." + \n "That is a predicate that returns the oposite of the original predicate."))] [])) diff --git a/stdlib/source/documentation/lux/data/collection.lux b/stdlib/source/documentation/lux/data/collection.lux index b4ae1f294..5712aa398 100644 --- a/stdlib/source/documentation/lux/data/collection.lux +++ b/stdlib/source/documentation/lux/data/collection.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]] diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index 8697a4686..b6bc74a63 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,107 +11,89 @@ [\\library ["[0]" /]]) -(documentation: (/.Array it) - "Mutable arrays.") +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.type_name) + ($.default /.equivalence) + ($.default /.monoid) + ($.default /.functor) + ($.default /.mix) + ($.default /.every?) + ($.default /.any?) -(documentation: /.empty - "An empty array of the specified size." - [(empty size)]) + ($.documentation (/.Array it) + "Mutable arrays.") -(documentation: /.size - "" - [(size array)]) + ($.documentation /.empty + "An empty array of the specified size." + [(empty size)]) -(documentation: /.item - "" - [(item index array)]) + ($.documentation /.size + "" + [(size array)]) -(documentation: /.has! - "Mutate the array by writing a value to the specified index." - [(has! index value array)]) + ($.documentation /.item + "" + [(item index array)]) -(documentation: /.lacks! - "Mutate the array by deleting the value at the specified index." - [(lacks! index array)]) + ($.documentation /.has! + "Mutate the array by writing a value to the specified index." + [(has! index value array)]) -(documentation: /.has? - "" - [(has? index array)]) + ($.documentation /.lacks! + "Mutate the array by deleting the value at the specified index." + [(lacks! index array)]) -(documentation: /.revised! - "Mutate the array by updating the value at the specified index." - [(revised! index transform array)]) + ($.documentation /.has? + "" + [(has? index array)]) -(documentation: /.upsert! - (format "Mutate the array by updating the value at the specified index." - \n "If there is no value, update and write the default value given.") - [(upsert! index default transform array)]) + ($.documentation /.revised! + "Mutate the array by updating the value at the specified index." + [(revised! index transform array)]) -(documentation: /.copy! - "Writes the contents of one array into the other." - [(copy! length src_start src_array dest_start dest_array)]) + ($.documentation /.upsert! + (format "Mutate the array by updating the value at the specified index." + \n "If there is no value, update and write the default value given.") + [(upsert! index default transform array)]) -(documentation: /.occupancy - "Finds out how many cells in an array are occupied." - [(occupancy array)]) + ($.documentation /.copy! + "Writes the contents of one array into the other." + [(copy! length src_start src_array dest_start dest_array)]) -(documentation: /.vacancy - "Finds out how many cells in an array are vacant." - [(vacancy array)]) + ($.documentation /.occupancy + "Finds out how many cells in an array are occupied." + [(occupancy array)]) -(documentation: /.only! - "Delete every item of the array that fails to satisfy the predicate." - [(only! p xs)]) + ($.documentation /.vacancy + "Finds out how many cells in an array are vacant." + [(vacancy array)]) -(documentation: /.example - "Yields the first item in the array that satisfies the predicate." - [(example p xs)]) + ($.documentation /.only! + "Delete every item of the array that fails to satisfy the predicate." + [(only! p xs)]) -(documentation: /.example' - "Just like 'example', but with access to the index of each value." - [(example' p xs)]) + ($.documentation /.example + "Yields the first item in the array that satisfies the predicate." + [(example p xs)]) -(documentation: /.clone - "Yields a shallow clone of the array." - [(clone xs)]) + ($.documentation /.example' + "Just like 'example', but with access to the index of each value." + [(example' p xs)]) -(documentation: /.of_list - "" - [(of_list xs)]) + ($.documentation /.clone + "Yields a shallow clone of the array." + [(clone xs)]) -(documentation: /.list - (format "Yields a list with every non-empty item in the array." - \n "Can use the optional default value when encountering an empty cell in the array.") - [(list {.#None} array) - (list {.#Some default} array)]) + ($.documentation /.of_list + "" + [(of_list xs)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Array - ..empty - ..size - ..item - ..has! - ..lacks! - ..has? - ..revised! - ..upsert! - ..copy! - ..occupancy - ..vacancy - ..only! - ..example - ..example' - ..clone - ..of_list - ..list - ($.default /.type_name) - ($.default /.equivalence) - ($.default /.monoid) - ($.default /.functor) - ($.default /.mix) - ($.default /.every?) - ($.default /.any?)] + ($.documentation /.list + (format "Yields a list with every non-empty item in the array." + \n "Can use the optional default value when encountering an empty cell in the array.") + [(list {.#None} array) + (list {.#Some default} array)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index 075c71091..55d0354b0 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except or and not) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,42 +11,11 @@ [\\library ["[0]" /]]) -(documentation: /.Bits - "A bit-map.") - -(documentation: /.size - "Measures the size of a bit-map by counting all the 1s in the bit-map." - [(size bits)]) - -(documentation: /.capacity - "" - [(capacity bits)]) - -(documentation: /.bit - "" - [(bit index bits)]) - -(documentation: /.intersects? - "" - [(intersects? reference sample)]) - -(documentation: /.not - "" - [(not input)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Bits - ..size - ..capacity - ..bit - - ..intersects? - ..not - - ($.default /.Chunk) + [($.default /.Chunk) ($.default /.chunk_size) ($.default /.empty) ($.default /.empty?) @@ -56,5 +25,28 @@ ($.default /.flipped) ($.default /.and) ($.default /.or) - ($.default /.xor)] + ($.default /.xor) + + ($.documentation /.Bits + "A bit-map.") + + ($.documentation /.size + "Measures the size of a bit-map by counting all the 1s in the bit-map." + [(size bits)]) + + ($.documentation /.capacity + "" + [(capacity bits)]) + + ($.documentation /.bit + "" + [(bit index bits)]) + + ($.documentation /.intersects? + "" + [(intersects? reference sample)]) + + ($.documentation /.not + "" + [(not input)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index 72ed210aa..114050284 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except has revised) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -14,90 +14,76 @@ ["[1][0]" ordered] ["[1][0]" plist]]) -(documentation: (/.Dictionary key value) - "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).") +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.key_hash) + ($.default /.key_already_exists) + ($.default /.size) + ($.default /.empty?) + ($.default /.entries) + ($.default /.keys) + ($.default /.values) + ($.default /.equivalence) + ($.default /.functor) -(documentation: /.empty - "An empty dictionary." - [(empty key_hash)]) + ($.documentation (/.Dictionary key value) + "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).") -(documentation: /.has - "" - [(has key val dict)]) + ($.documentation /.empty + "An empty dictionary." + [(empty key_hash)]) -(documentation: /.lacks - "" - [(lacks key dict)]) + ($.documentation /.has + "" + [(has key val dict)]) -(documentation: /.value - "" - [(value key dict)]) + ($.documentation /.lacks + "" + [(lacks key dict)]) -(documentation: /.key? - "" - [(key? dict key)]) + ($.documentation /.value + "" + [(value key dict)]) -(documentation: /.has' - "Only puts the KV-pair if the key is not already present." - [(has' key val dict)]) + ($.documentation /.key? + "" + [(key? dict key)]) -(documentation: /.revised - "Transforms the value located at key (if available), using the given function." - [(revised key f dict)]) + ($.documentation /.has' + "Only puts the KV-pair if the key is not already present." + [(has' key val dict)]) -(documentation: /.revised' - (format "Updates the value at the key; if it exists." - \n "Otherwise, puts a value by applying the function to a default.") - [(revised' key default f dict)]) + ($.documentation /.revised + "Transforms the value located at key (if available), using the given function." + [(revised key f dict)]) -(documentation: /.of_list - "" - [(of_list key_hash kvs)]) + ($.documentation /.revised' + (format "Updates the value at the key; if it exists." + \n "Otherwise, puts a value by applying the function to a default.") + [(revised' key default f dict)]) -(documentation: /.composite - (format "Merges 2 dictionaries." - \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.") - [(composite dict2 dict1)]) + ($.documentation /.of_list + "" + [(of_list key_hash kvs)]) -(documentation: /.composite_with - (format "Merges 2 dictionaries." - \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.") - [(composite_with f dict2 dict1)]) + ($.documentation /.composite + (format "Merges 2 dictionaries." + \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.") + [(composite dict2 dict1)]) -(documentation: /.re_bound - "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'." - [(re_bound from_key to_key dict)]) + ($.documentation /.composite_with + (format "Merges 2 dictionaries." + \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.") + [(composite_with f dict2 dict1)]) -(documentation: /.sub - "A sub-dictionary, with only the specified keys." - [(sub keys dict)]) + ($.documentation /.re_bound + "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'." + [(re_bound from_key to_key dict)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Dictionary - ..empty - ..has - ..lacks - ..value - ..key? - ..has' - ..revised - ..revised' - ..of_list - ..composite - ..composite_with - ..re_bound - ..sub - ($.default /.key_hash) - ($.default /.key_already_exists) - ($.default /.size) - ($.default /.empty?) - ($.default /.entries) - ($.default /.keys) - ($.default /.values) - ($.default /.equivalence) - ($.default /.functor)] + ($.documentation /.sub + "A sub-dictionary, with only the specified keys." + [(sub keys dict)])] [/ordered.documentation /plist.documentation])) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index d5f857c5c..a946434d6 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except has revised) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,69 +11,56 @@ [\\library ["[0]" /]]) -(documentation: (/.Dictionary key value) - "A dictionary data-structure with ordered entries.") +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.empty?) + ($.default /.entries) + ($.default /.keys) + ($.default /.values) + ($.default /.equivalence) -(documentation: /.empty - "An empty dictionary, employing the given order." - [(empty order)]) + ($.documentation (/.Dictionary key value) + "A dictionary data-structure with ordered entries.") -(documentation: /.value - "" - [(value key dict)]) + ($.documentation /.empty + "An empty dictionary, employing the given order." + [(empty order)]) -(documentation: /.key? - "" - [(key? dict key)]) + ($.documentation /.value + "" + [(value key dict)]) -(with_template [<name>] - [(`` (documentation: <name> - (format "Yields value under the " (~~ (template.text [<name>])) "imum key.")))] + ($.documentation /.key? + "" + [(key? dict key)]) - [/.min] - [/.max] - ) + (~~ (with_template [<name>] + [(`` ($.documentation <name> + (format "Yields value under the " (~~ (template.text [<name>])) "imum key.")))] -(documentation: /.size - "" - [(size dict)]) + [/.min] + [/.max] + )) -(documentation: /.has - "" - [(has key value dict)]) + ($.documentation /.size + "" + [(size dict)]) -(documentation: /.lacks - "" - [(lacks key dict)]) + ($.documentation /.has + "" + [(has key value dict)]) -(documentation: /.revised - "" - [(revised key transform dict)]) + ($.documentation /.lacks + "" + [(lacks key dict)]) -(documentation: /.of_list - "" - [(of_list order list)]) + ($.documentation /.revised + "" + [(revised key transform dict)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Dictionary - ..empty - ..value - ..key? - - ..min - ..max - - ..size - ..has - ..lacks - ..revised - ..of_list - ($.default /.empty?) - ($.default /.entries) - ($.default /.keys) - ($.default /.values) - ($.default /.equivalence)] - [])) + ($.documentation /.of_list + "" + [(of_list order list)])] + []))) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux index 0dafc6340..2e478812e 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except has revised) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,44 +11,38 @@ [\\library ["[0]" /]]) -(documentation: (/.PList it) - (format "A property list." - \n "It's a simple dictionary-like structure with Text keys.")) - -(documentation: /.value - "" - [(value key properties)]) - -(documentation: /.contains? - "" - [(contains? key properties)]) - -(documentation: /.has - "" - [(has key val properties)]) - -(documentation: /.revised - "" - [(revised key f properties)]) - -(documentation: /.lacks - "" - [(lacks key properties)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..PList - ..value - ..contains? - ..has - ..revised - ..lacks - ($.default /.empty) + [($.default /.empty) ($.default /.size) ($.default /.empty?) ($.default /.keys) ($.default /.values) - ($.default /.equivalence)] + ($.default /.equivalence) + + ($.documentation (/.PList it) + (format "A property list." + \n "It's a simple dictionary-like structure with Text keys.")) + + ($.documentation /.value + "" + [(value key properties)]) + + ($.documentation /.contains? + "" + [(contains? key properties)]) + + ($.documentation /.has + "" + [(has key val properties)]) + + ($.documentation /.revised + "" + [(revised key f properties)]) + + ($.documentation /.lacks + "" + [(lacks key properties)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 8d8a47651..e0699154e 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except all) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,193 +11,158 @@ [\\library ["[0]" /]]) -(documentation: /.mixes - "" - [(mixes f init inputs)]) - -(documentation: /.reversed - "" - [(reversed xs)]) - -(documentation: /.only - "A list with only values that satisfy the predicate." - [(only keep? xs)]) - -(documentation: /.partition - "Divide the list into all elements that satisfy a predicate, and all elements that do not." - [(partition satisfies? list)]) - -(documentation: /.pairs - "Cut the list into pairs of 2." - [(pairs list)]) - -(documentation: /.split_at - "" - [(split_at n xs)]) - -(documentation: /.split_when - "Segment the list by using a predicate to tell when to cut." - [(split_when predicate xs)]) - -(documentation: /.sub - "Segment the list into sub-lists of (at most) the given size." - [(sub size list)]) - -(documentation: /.repeated - "A list of the value x, repeated n times." - [(repeated n x)]) - -(documentation: /.iterations - "Generates a list element by element until the function returns .#None." - [(iterations f x)]) - -(documentation: /.one - "" - [(one check xs)]) - -(documentation: /.all - "" - [(all check xs)]) - -(documentation: /.example - "Yields the first value in the list that satisfies the predicate." - [(example predicate xs)]) - -(documentation: /.interposed - "Puts a value between every two elements in the list." - [(interposed sep xs)]) - -(documentation: /.size - "" - [(size list)]) - -(documentation: /.item - "Fetches the element at the specified index." - [(item i xs)]) - -(documentation: /.sorted - "A list ordered by a comparison function." - [(sorted < xs)]) - -(documentation: /.empty? - "" - [(empty? xs)]) - -(documentation: /.member? - "" - [(member? eq xs x)]) - -(with_template [<name> <doc>] - [(documentation: <name> - <doc>)] - - [/.head "Yields the first element of a list."] - [/.tail "For a list of size N, yields the N-1 elements after the first one."] - ) - -(documentation: /.indices - "Produces all the valid indices for a given size." - [(indices size)]) - -(documentation: /.zipped - "Create list zippers with the specified number of input lists." - [(def zipped_2 (zipped 2)) - (def zipped_3 (zipped 3)) - (zipped_3 xs ys zs) - ((zipped 3) xs ys zs)]) - -(documentation: /.zipped_with - "Create list zippers with the specified number of input lists." - [(def zipped_with_2 (zipped_with 2)) - (def zipped_with_3 (zipped_with 3)) - (zipped_with_2 + xs ys) - ((zipped_with 2) + xs ys)]) - -(documentation: /.last - "" - [(last xs)]) - -(documentation: /.inits - (format "For a list of size N, yields the first N-1 elements." - \n "Will yield a .#None for empty lists.") - [(inits xs)]) - -(documentation: /.together - "The sequential combination of all the lists.") - -(documentation: /.with - "Enhances a monad with List functionality." - [(with monad)]) - -(documentation: /.lifted - "Wraps a monadic value with List machinery." - [(lifted monad)]) - -(documentation: /.enumeration - "Pairs every element in the list with its index, starting at 0." - [(enumeration xs)]) - -(documentation: /.when - "Can be used as a guard in (co)monadic be/do expressions." - [(do monad - [value (do_something 1 2 3) - .when (passes_test? value)] - (do_something_else 4 5 6))]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..mixes - ..reversed - ..only - ..partition - ..pairs - - ..split_at - ..split_when - ..sub - ..repeated - ..iterations - ..one - ..all - ..example - ..interposed - ..size - - ..item - ..sorted - ..empty? - ..member? - - ..head - ..tail - - ..indices - ..zipped - ..zipped_with - ..last - ..inits - ..together - ..with - ..lifted - ..enumeration - ..when - ($.default /.mix) - ($.default /.equivalence) - ($.default /.hash) - ($.default /.monoid) - ($.default /.functor) - ($.default /.apply) - ($.default /.monad) - ($.default /.zipped_2) - ($.default /.zipped_3) - ($.default /.zipped_with_2) - ($.default /.zipped_with_3) - ($.default /.first) - ($.default /.after) - ($.default /.while) - ($.default /.until) - ($.default /.every?) - ($.default /.any?)] - [])) +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.mix) + ($.default /.equivalence) + ($.default /.hash) + ($.default /.monoid) + ($.default /.functor) + ($.default /.apply) + ($.default /.monad) + ($.default /.zipped_2) + ($.default /.zipped_3) + ($.default /.zipped_with_2) + ($.default /.zipped_with_3) + ($.default /.first) + ($.default /.after) + ($.default /.while) + ($.default /.until) + ($.default /.every?) + ($.default /.any?) + + ($.documentation /.mixes + "" + [(mixes f init inputs)]) + + ($.documentation /.reversed + "" + [(reversed xs)]) + + ($.documentation /.only + "A list with only values that satisfy the predicate." + [(only keep? xs)]) + + ($.documentation /.partition + "Divide the list into all elements that satisfy a predicate, and all elements that do not." + [(partition satisfies? list)]) + + ($.documentation /.pairs + "Cut the list into pairs of 2." + [(pairs list)]) + + ($.documentation /.split_at + "" + [(split_at n xs)]) + + ($.documentation /.split_when + "Segment the list by using a predicate to tell when to cut." + [(split_when predicate xs)]) + + ($.documentation /.sub + "Segment the list into sub-lists of (at most) the given size." + [(sub size list)]) + + ($.documentation /.repeated + "A list of the value x, repeated n times." + [(repeated n x)]) + + ($.documentation /.iterations + "Generates a list element by element until the function returns .#None." + [(iterations f x)]) + + ($.documentation /.one + "" + [(one check xs)]) + + ($.documentation /.all + "" + [(all check xs)]) + + ($.documentation /.example + "Yields the first value in the list that satisfies the predicate." + [(example predicate xs)]) + + ($.documentation /.interposed + "Puts a value between every two elements in the list." + [(interposed sep xs)]) + + ($.documentation /.size + "" + [(size list)]) + + ($.documentation /.item + "Fetches the element at the specified index." + [(item i xs)]) + + ($.documentation /.sorted + "A list ordered by a comparison function." + [(sorted < xs)]) + + ($.documentation /.empty? + "" + [(empty? xs)]) + + ($.documentation /.member? + "" + [(member? eq xs x)]) + + (~~ (with_template [<name> <doc>] + [($.documentation <name> + <doc>)] + + [/.head "Yields the first element of a list."] + [/.tail "For a list of size N, yields the N-1 elements after the first one."] + )) + + ($.documentation /.indices + "Produces all the valid indices for a given size." + [(indices size)]) + + ($.documentation /.zipped + "Create list zippers with the specified number of input lists." + [(def zipped_2 (zipped 2)) + (def zipped_3 (zipped 3)) + (zipped_3 xs ys zs) + ((zipped 3) xs ys zs)]) + + ($.documentation /.zipped_with + "Create list zippers with the specified number of input lists." + [(def zipped_with_2 (zipped_with 2)) + (def zipped_with_3 (zipped_with 3)) + (zipped_with_2 + xs ys) + ((zipped_with 2) + xs ys)]) + + ($.documentation /.last + "" + [(last xs)]) + + ($.documentation /.inits + (format "For a list of size N, yields the first N-1 elements." + \n "Will yield a .#None for empty lists.") + [(inits xs)]) + + ($.documentation /.together + "The sequential combination of all the lists.") + + ($.documentation /.with + "Enhances a monad with List functionality." + [(with monad)]) + + ($.documentation /.lifted + "Wraps a monadic value with List machinery." + [(lifted monad)]) + + ($.documentation /.enumeration + "Pairs every element in the list with its index, starting at 0." + [(enumeration xs)]) + + ($.documentation /.when + "Can be used as a guard in (co)monadic be/do expressions." + [(do monad + [value (do_something 1 2 3) + .when (passes_test? value)] + (do_something_else 4 5 6))])] + []))) diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux index 19fee78c9..963776aa5 100644 --- a/stdlib/source/documentation/lux/data/collection/queue.lux +++ b/stdlib/source/documentation/lux/data/collection/queue.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -13,46 +13,39 @@ ["[0]" / ["[1][0]" priority]]) -(documentation: (/.Queue it) - "A first-in, first-out sequential data-structure.") - -(documentation: /.of_list - "" - [(of_list entries)]) - -(documentation: /.list - "" - [(list queue)]) - -(documentation: /.front - "Yields the first value in the queue, if any.") - -(documentation: /.member? - "" - [(member? equivalence queue member)]) - -(documentation: /.next - "" - [(next queue)]) - -(documentation: /.end - "" - [(end val queue)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Queue - ..of_list - ..list - ..front - ..member? - ..next - ..end - ($.default /.empty) + [($.default /.empty) ($.default /.size) ($.default /.empty?) ($.default /.equivalence) - ($.default /.functor)] + ($.default /.functor) + + ($.documentation (/.Queue it) + "A first-in, first-out sequential data-structure.") + + ($.documentation /.of_list + "" + [(of_list entries)]) + + ($.documentation /.list + "" + [(list queue)]) + + ($.documentation /.front + "Yields the first value in the queue, if any.") + + ($.documentation /.member? + "" + [(member? equivalence queue member)]) + + ($.documentation /.next + "" + [(next queue)]) + + ($.documentation /.end + "" + [(end val queue)])] [/priority.documentation])) diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux index 47ccd89bb..4952a6954 100644 --- a/stdlib/source/documentation/lux/data/collection/queue/priority.lux +++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,21 +11,11 @@ [\\library ["[0]" /]]) -(documentation: /.member? - "" - [(member? equivalence queue member)]) - -(documentation: /.end - "" - [(end priority value queue)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..member? - ..end - ($.default /.Priority) + [($.default /.Priority) ($.default /.max) ($.default /.min) ($.default (/.Queue it)) @@ -33,5 +23,13 @@ ($.default /.front) ($.default /.size) ($.default /.next) - ($.default /.empty?)] + ($.default /.empty?) + + ($.documentation /.member? + "" + [(member? equivalence queue member)]) + + ($.documentation /.end + "" + [(end priority value queue)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 7c286aa0a..283eca310 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list has revised) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,61 +11,11 @@ [\\library ["[0]" /]]) -(documentation: (/.Sequence it) - "A sequential data-structure with fast random access.") - -(documentation: /.suffix - "" - [(suffix val sequence)]) - -(documentation: /.within_bounds? - "Determines whether the index is within the bounds of the sequence." - [(within_bounds? sequence idx)]) - -(documentation: /.item - "" - [(item idx sequence)]) - -(documentation: /.has - "" - [(has idx val sequence)]) - -(documentation: /.revised - "" - [(revised idx f sequence)]) - -(documentation: /.prefix - "" - [(prefix sequence)]) - -(documentation: /.list - "" - [(list sequence)]) - -(documentation: /.member? - "" - [(member? equivalence sequence val)]) - -(documentation: /.sequence - "Sequence literals." - [(is (Sequence Nat) - (sequence 12 34 56 78 90))]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Sequence - ..suffix - ..within_bounds? - ..item - ..has - ..revised - ..prefix - ..list - ..member? - ..sequence - ($.default /.empty) + [($.default /.empty) ($.default /.size) ($.default /.index_out_of_bounds) ($.default /.of_list) @@ -78,5 +28,45 @@ ($.default /.monad) ($.default /.reversed) ($.default /.every?) - ($.default /.any?)] + ($.default /.any?) + + ($.documentation (/.Sequence it) + "A sequential data-structure with fast random access.") + + ($.documentation /.suffix + "" + [(suffix val sequence)]) + + ($.documentation /.within_bounds? + "Determines whether the index is within the bounds of the sequence." + [(within_bounds? sequence idx)]) + + ($.documentation /.item + "" + [(item idx sequence)]) + + ($.documentation /.has + "" + [(has idx val sequence)]) + + ($.documentation /.revised + "" + [(revised idx f sequence)]) + + ($.documentation /.prefix + "" + [(prefix sequence)]) + + ($.documentation /.list + "" + [(list sequence)]) + + ($.documentation /.member? + "" + [(member? equivalence sequence val)]) + + ($.documentation /.sequence + "Sequence literals." + [(is (Sequence Nat) + (sequence 12 34 56 78 90))])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/set.lux b/stdlib/source/documentation/lux/data/collection/set.lux index 2eb5f11c9..b3a16c70c 100644 --- a/stdlib/source/documentation/lux/data/collection/set.lux +++ b/stdlib/source/documentation/lux/data/collection/set.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list has) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -13,36 +13,11 @@ ["[1][0]" multi] ["[1][0]" ordered]]) -(documentation: /.has - "" - [(has elem set)]) - -(documentation: /.difference - "" - [(difference sub base)]) - -(documentation: /.intersection - "" - [(intersection filter base)]) - -(documentation: /.sub? - "" - [(sub? super sub)]) - -(documentation: /.super? - "" - [(super? sub super)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..has - ..difference - ..intersection - ..sub? - ..super? - ($.default (/.Set it)) + [($.default (/.Set it)) ($.default /.member_hash) ($.default /.empty) ($.default /.size) @@ -55,6 +30,26 @@ ($.default /.monoid) ($.default /.empty?) ($.default /.of_list) - ($.default /.predicate)] + ($.default /.predicate) + + ($.documentation /.has + "" + [(has elem set)]) + + ($.documentation /.difference + "" + [(difference sub base)]) + + ($.documentation /.intersection + "" + [(intersection filter base)]) + + ($.documentation /.sub? + "" + [(sub? super sub)]) + + ($.documentation /.super? + "" + [(super? sub super)])] [/multi.documentation /ordered.documentation])) diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index 5f48a9e9e..8c494a583 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list has) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,50 +10,11 @@ [\\library ["[0]" /]]) -(documentation: (/.Set it) - "A set that keeps track of repetition in its entries.") - -(documentation: /.has - "" - [(has multiplicity elem set)]) - -(documentation: /.lacks - "" - [(lacks multiplicity elem set)]) - -(documentation: /.multiplicity - "" - [(multiplicity set elem)]) - -(documentation: /.sub? - "Is 'subject' a sub-set of 'reference'?" - [(sub? reference subject)]) - -(documentation: /.support - "A set of the unique (non repeated) members." - [(support set)]) - -(documentation: /.member? - "" - [(member? set elem)]) - -(documentation: /.super? - "Is 'subject' a super-set of 'reference'?") - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Set - ..has - ..lacks - ..multiplicity - - ..sub? - ..support - ..member? - ..super? - ($.default /.empty) + [($.default /.empty) ($.default /.size) ($.default /.list) ($.default /.equivalence) @@ -64,5 +25,35 @@ ($.default /.union) ($.default /.sum) ($.default /.intersection) - ($.default /.difference)] + ($.default /.difference) + + ($.documentation (/.Set it) + "A set that keeps track of repetition in its entries.") + + ($.documentation /.has + "" + [(has multiplicity elem set)]) + + ($.documentation /.lacks + "" + [(lacks multiplicity elem set)]) + + ($.documentation /.multiplicity + "" + [(multiplicity set elem)]) + + ($.documentation /.sub? + "Is 'subject' a sub-set of 'reference'?" + [(sub? reference subject)]) + + ($.documentation /.support + "A set of the unique (non repeated) members." + [(support set)]) + + ($.documentation /.member? + "" + [(member? set elem)]) + + ($.documentation /.super? + "Is 'subject' a super-set of 'reference'?")] [])) diff --git a/stdlib/source/documentation/lux/data/collection/set/ordered.lux b/stdlib/source/documentation/lux/data/collection/set/ordered.lux index 88ae58dc6..ac34d2f5d 100644 --- a/stdlib/source/documentation/lux/data/collection/set/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/set/ordered.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list has) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,45 +10,11 @@ [\\library ["[0]" /]]) -(documentation: (/.Set it) - "A set with ordered entries.") - -(documentation: /.member? - "" - [(member? set elem)]) - -(documentation: /.has - "" - [(has elem set)]) - -(documentation: /.lacks - "" - [(lacks elem set)]) - -(documentation: /.difference - "" - [(difference param subject)]) - -(documentation: /.sub? - "Is 'sub' a sub-set of 'super'?" - [(sub? super sub)]) - -(documentation: /.super? - "Is 'super' a super-set of 'sub'?" - [(super? sub super)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Set - ..member? - ..has - ..lacks - ..difference - ..sub? - ..super? - ($.default /.empty) + [($.default /.empty) ($.default /.min) ($.default /.max) ($.default /.size) @@ -57,5 +23,32 @@ ($.default /.of_list) ($.default /.union) ($.default /.intersection) - ($.default /.equivalence)] + ($.default /.equivalence) + + ($.documentation (/.Set it) + "A set with ordered entries.") + + ($.documentation /.member? + "" + [(member? set elem)]) + + ($.documentation /.has + "" + [(has elem set)]) + + ($.documentation /.lacks + "" + [(lacks elem set)]) + + ($.documentation /.difference + "" + [(difference param subject)]) + + ($.documentation /.sub? + "Is 'sub' a sub-set of 'super'?" + [(sub? super sub)]) + + ($.documentation /.super? + "Is 'super' a super-set of 'sub'?" + [(super? sub super)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/stack.lux b/stdlib/source/documentation/lux/data/collection/stack.lux index da805da8a..e05e774c2 100644 --- a/stdlib/source/documentation/lux/data/collection/stack.lux +++ b/stdlib/source/documentation/lux/data/collection/stack.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,32 +10,28 @@ [\\library ["[0]" /]]) -(documentation: (/.Stack it) - "A first-in, last-out sequential data-structure.") - -(documentation: /.value - "Yields the top value in the stack, if any." - [(value stack)]) - -(documentation: /.next - "" - [(next stack)]) - -(documentation: /.top - "" - [(top value stack)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Stack - ..value - ..next - ..top - ($.default /.empty) + [($.default /.empty) ($.default /.size) ($.default /.empty?) ($.default /.equivalence) - ($.default /.functor)] + ($.default /.functor) + + ($.documentation (/.Stack it) + "A first-in, last-out sequential data-structure.") + + ($.documentation /.value + "Yields the top value in the stack, if any." + [(value stack)]) + + ($.documentation /.next + "" + [(next stack)]) + + ($.documentation /.top + "" + [(top value stack)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index f77decc5e..5a5021150 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list pattern) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -11,55 +11,11 @@ [\\library ["[0]" /]]) -(documentation: (/.Stream it) - "An infinite sequence of values.") - -(documentation: /.iterations - "A stateful way of infinitely calculating the values of a stream." - [(iterations step init)]) - -(documentation: /.repeated - "Repeat a value forever." - [(repeated x)]) - -(documentation: /.cycle - "Go over the elements of a list forever." - [(cycle [start next])]) - -(documentation: /.item - "" - [(item idx stream)]) - -(documentation: /.only - "A new stream only with items that satisfy the predicate." - [(only predicate stream)]) - -(documentation: /.partition - (format "Split a stream in two based on a predicate." - \n "The left side contains all entries for which the predicate is #1." - \n "The right side contains all entries for which the predicate is #0.") - [(partition left? xs)]) - -(documentation: /.pattern - (format "Allows destructuring of streams in pattern-matching expressions." - \n "Caveat emptor: Only use it for destructuring, and not for testing values within the streams.") - [(let [(pattern x y z _tail) (some_stream_func +1 +2 +3)] - (func x y z))]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Stream - ..iterations - ..repeated - ..cycle - ..item - - ..only - ..partition - ..pattern - ($.default /.head) + [($.default /.head) ($.default /.tail) ($.default /.functor) ($.default /.comonad) @@ -68,5 +24,40 @@ ($.default /.first) ($.default /.after) ($.default /.split_when) - ($.default /.split_at)] + ($.default /.split_at) + + ($.documentation (/.Stream it) + "An infinite sequence of values.") + + ($.documentation /.iterations + "A stateful way of infinitely calculating the values of a stream." + [(iterations step init)]) + + ($.documentation /.repeated + "Repeat a value forever." + [(repeated x)]) + + ($.documentation /.cycle + "Go over the elements of a list forever." + [(cycle [start next])]) + + ($.documentation /.item + "" + [(item idx stream)]) + + ($.documentation /.only + "A new stream only with items that satisfy the predicate." + [(only predicate stream)]) + + ($.documentation /.partition + (format "Split a stream in two based on a predicate." + \n "The left side contains all entries for which the predicate is #1." + \n "The right side contains all entries for which the predicate is #0.") + [(partition left? xs)]) + + ($.documentation /.pattern + (format "Allows destructuring of streams in pattern-matching expressions." + \n "Caveat emptor: Only use it for destructuring, and not for testing values within the streams.") + [(let [(pattern x y z _tail) (some_stream_func +1 +2 +3)] + (func x y z))])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index 9c9fe9ad5..91324bbcf 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -13,40 +13,35 @@ ["[1][0]" finger] ["[1][0]" zipper]]) -(documentation: (/.Tree it) - "A generic tree data-structure.") - -(documentation: /.flat - "All the leaf values of the tree, in order." - [(flat tree)]) - -(documentation: /.leaf - "" - [(leaf value)]) - -(documentation: /.branch - "" - [(branch value children)]) - -(documentation: /.tree - "Tree literals." - [(is (Tree Nat) - (tree 12 - {34 {} - 56 {} - 78 {90 {}}}))]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Tree - ..flat - ..leaf - ..branch - ..tree - ($.default /.equivalence) + [($.default /.equivalence) ($.default /.functor) - ($.default /.mix)] + ($.default /.mix) + + ($.documentation (/.Tree it) + "A generic tree data-structure.") + + ($.documentation /.flat + "All the leaf values of the tree, in order." + [(flat tree)]) + + ($.documentation /.leaf + "" + [(leaf value)]) + + ($.documentation /.branch + "" + [(branch value children)]) + + ($.documentation /.tree + "Tree literals." + [(is (Tree Nat) + (tree 12 + {34 {} + 56 {} + 78 {90 {}}}))])] [/finger.documentation /zipper.documentation])) diff --git a/stdlib/source/documentation/lux/data/collection/tree/finger.lux b/stdlib/source/documentation/lux/data/collection/tree/finger.lux index 31f2dac1f..7386f313e 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/finger.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/finger.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,48 +10,40 @@ [\\library ["[0]" /]]) -(documentation: (/.Tree @ tag value) - "A finger tree.") +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.tag) + ($.default /.root) -(documentation: (/.Builder @ tag) - "A builder for finter tree structures.") + ($.documentation (/.Tree @ tag value) + "A finger tree.") -(documentation: /.builder - "A new builder using the given monoid." - [(builder monoid)]) + ($.documentation (/.Builder @ tag) + "A builder for finter tree structures.") -(documentation: /.value - "" - [(value tree)]) + ($.documentation /.builder + "A new builder using the given monoid." + [(builder monoid)]) -(documentation: /.tags - "" - [(tags tree)]) + ($.documentation /.value + "" + [(value tree)]) -(documentation: /.values - "" - [(values tree)]) + ($.documentation /.tags + "" + [(tags tree)]) -(documentation: /.one - "Finds one value that meets the predicate." - [(one predicate tree)]) + ($.documentation /.values + "" + [(values tree)]) -(documentation: /.exists? - "Verifies that a value exists which meets the predicate." - [(exists? predicate tree)]) + ($.documentation /.one + "Finds one value that meets the predicate." + [(one predicate tree)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Tree - ..Builder - ..builder - ..value - ..tags - ..values - ..one - ..exists? - ($.default /.tag) - ($.default /.root)] + ($.documentation /.exists? + "Verifies that a value exists which meets the predicate." + [(exists? predicate tree)])] [])) diff --git a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux index 4ad5aae46..76fb1602c 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except list) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,35 +10,11 @@ [\\library ["[0]" /]]) -(documentation: (/.Zipper it) - "Tree zippers, for easy navigation and editing of trees.") - -(documentation: /.set - "" - [(set value zipper)]) - -(documentation: /.update - "" - [(update transform zipper)]) - -(documentation: /.interpose - "" - [(interpose value zipper)]) - -(documentation: /.adopt - "" - [(adopt value zipper)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Zipper - ..set - ..update - ..interpose - ..adopt - ($.default /.equivalence) + [($.default /.equivalence) ($.default /.zipper) ($.default /.tree) ($.default /.value) @@ -60,5 +36,24 @@ ($.default /.insert_left) ($.default /.insert_right) ($.default /.functor) - ($.default /.comonad)] + ($.default /.comonad) + + ($.documentation (/.Zipper it) + "Tree zippers, for easy navigation and editing of trees.") + + ($.documentation /.set + "" + [(set value zipper)]) + + ($.documentation /.update + "" + [(update transform zipper)]) + + ($.documentation /.interpose + "" + [(interpose value zipper)]) + + ($.documentation /.adopt + "" + [(adopt value zipper)])] [])) diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index 603ccb07b..fade67993 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -15,114 +15,92 @@ ["[0]" / ["[1][0]" named]]) -(documentation: /.RGB - "Red-Green-Blue color format.") - -(documentation: /.HSL - "Hue-Saturation-Lightness color format.") - -(documentation: /.CMYK - "Cyan-Magenta-Yellow-Key color format.") - -(documentation: /.HSB - "Hue-Saturation-Brightness color format.") - -(documentation: /.Color - "A color value, independent of color format.") - -(documentation: /.complement - "The opposite color." - [(complement color)]) - -(documentation: /.interpolated - "" - [(interpolated ratio end start)]) - (def palette_documentation (syntax (_ [[_ name] <code>.symbol]) (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))) -(documentation: /.analogous - (palette_documentation /.analogous) - [(analogous spread variations color)]) - -(documentation: /.monochromatic - (palette_documentation /.monochromatic) - [(monochromatic spread variations color)]) - -(documentation: /.Alpha - "The degree of transparency of a pigment.") - -(documentation: /.transparent - "The maximum degree of transparency.") - -(documentation: /.translucent - "The average degree of transparency.") - -(documentation: /.opaque - "The minimum degree of transparency.") - -(documentation: /.Pigment - "A color with some degree of transparency.") - -(with_template [<name>] - [(`` (documentation: <name> - (format "A " - (text.replaced "_" "-" (~~ (template.text [<name>]))) - " color scheme.")))] - - [/.triad] - [/.clash] - [/.split_complement] - [/.square] - [/.tetradic] - ) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..RGB - ..HSL - ..CMYK - ..HSB - ..Color - ..complement - ..interpolated - - ..analogous - ..monochromatic - ..Alpha - ..transparent - ..translucent - ..opaque - ..Pigment - - ..triad - ..clash - ..split_complement - ..square - ..tetradic - - ($.default /.of_rgb) - ($.default /.rgb) - ($.default /.equivalence) - ($.default /.hash) - ($.default /.black) - ($.default /.white) - ($.default /.addition) - ($.default /.subtraction) - ($.default /.hsl) - ($.default /.of_hsl) - ($.default /.hsb) - ($.default /.of_hsb) - ($.default /.cmyk) - ($.default /.of_cmyk) - ($.default /.gray_scale) - ($.default /.Spread) - ($.default /.Palette) - ($.default /.darker) - ($.default /.brighter) - ($.default /.saturated) - ($.default /.un_saturated)] - [/named.documentation])) +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.of_rgb) + ($.default /.rgb) + ($.default /.equivalence) + ($.default /.hash) + ($.default /.black) + ($.default /.white) + ($.default /.addition) + ($.default /.subtraction) + ($.default /.hsl) + ($.default /.of_hsl) + ($.default /.hsb) + ($.default /.of_hsb) + ($.default /.cmyk) + ($.default /.of_cmyk) + ($.default /.gray_scale) + ($.default /.Spread) + ($.default /.Palette) + ($.default /.darker) + ($.default /.brighter) + ($.default /.saturated) + ($.default /.un_saturated) + + ($.documentation /.RGB + "Red-Green-Blue color format.") + + ($.documentation /.HSL + "Hue-Saturation-Lightness color format.") + + ($.documentation /.CMYK + "Cyan-Magenta-Yellow-Key color format.") + + ($.documentation /.HSB + "Hue-Saturation-Brightness color format.") + + ($.documentation /.Color + "A color value, independent of color format.") + + ($.documentation /.complement + "The opposite color." + [(complement color)]) + + ($.documentation /.interpolated + "" + [(interpolated ratio end start)]) + + ($.documentation /.analogous + (palette_documentation /.analogous) + [(analogous spread variations color)]) + + ($.documentation /.monochromatic + (palette_documentation /.monochromatic) + [(monochromatic spread variations color)]) + + ($.documentation /.Alpha + "The degree of transparency of a pigment.") + + ($.documentation /.transparent + "The maximum degree of transparency.") + + ($.documentation /.translucent + "The average degree of transparency.") + + ($.documentation /.opaque + "The minimum degree of transparency.") + + ($.documentation /.Pigment + "A color with some degree of transparency.") + + (~~ (with_template [<name>] + [(`` ($.documentation <name> + (format "A " + (text.replaced "_" "-" (~~ (template.text [<name>]))) + " color scheme.")))] + + [/.triad] + [/.clash] + [/.split_complement] + [/.square] + [/.tetradic] + ))] + [/named.documentation]))) diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index d905485f0..94f5df07b 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -1,315 +1,173 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)]]] [macro ["[0]" code] ["[0]" template]] [math [number - ["[0]" nat ("hex#[0]" hex)]]]]] + ["[0]" nat (.use "hex#[0]" hex)]]]]] [\\library - ["[0]" / + ["[0]" / (.only) ["/[1]" //]]]) -(with_template [<name>] - [(documentation: <name> - (let [[red green blue] (//.rgb <name>) - [_ name] (symbol <name>)] - (format "R:" (hex#encoded red) - " G:" (hex#encoded green) - " B:" (hex#encoded blue) - " | " (text.replaced "_" " " name))))] +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [(~~ (with_template [<name>] + [($.documentation <name> + (let [[red green blue] (//.rgb <name>) + [_ name] (symbol <name>)] + (format "R:" (hex#encoded red) + " G:" (hex#encoded green) + " B:" (hex#encoded blue) + " | " (text.replaced "_" " " name))))] - [/.alice_blue] - [/.antique_white] - [/.aqua] - [/.aquamarine] - [/.azure] - [/.beige] - [/.bisque] - [/.black] - [/.blanched_almond] - [/.blue] - [/.blue_violet] - [/.brown] - [/.burly_wood] - [/.cadet_blue] - [/.chartreuse] - [/.chocolate] - [/.coral] - [/.cornflower_blue] - [/.cornsilk] - [/.crimson] - [/.cyan] - [/.dark_blue] - [/.dark_cyan] - [/.dark_goldenrod] - [/.dark_gray] - [/.dark_green] - [/.dark_khaki] - [/.dark_magenta] - [/.dark_olive_green] - [/.dark_orange] - [/.dark_orchid] - [/.dark_red] - [/.dark_salmon] - [/.dark_sea_green] - [/.dark_slate_blue] - [/.dark_slate_gray] - [/.dark_turquoise] - [/.dark_violet] - [/.deep_pink] - [/.deep_sky_blue] - [/.dim_gray] - [/.dodger_blue] - [/.fire_brick] - [/.floral_white] - [/.forest_green] - [/.fuchsia] - [/.gainsboro] - [/.ghost_white] - [/.gold] - [/.goldenrod] - [/.gray] - [/.green] - [/.green_yellow] - [/.honey_dew] - [/.hot_pink] - [/.indian_red] - [/.indigo] - [/.ivory] - [/.khaki] - [/.lavender] - [/.lavender_blush] - [/.lawn_green] - [/.lemon_chiffon] - [/.light_blue] - [/.light_coral] - [/.light_cyan] - [/.light_goldenrod_yellow] - [/.light_gray] - [/.light_green] - [/.light_pink] - [/.light_salmon] - [/.light_sea_green] - [/.light_sky_blue] - [/.light_slate_gray] - [/.light_steel_blue] - [/.light_yellow] - [/.lime] - [/.lime_green] - [/.linen] - [/.magenta] - [/.maroon] - [/.medium_aquamarine] - [/.medium_blue] - [/.medium_orchid] - [/.medium_purple] - [/.medium_sea_green] - [/.medium_slate_blue] - [/.medium_spring_green] - [/.medium_turquoise] - [/.medium_violet_red] - [/.midnight_blue] - [/.mint_cream] - [/.misty_rose] - [/.moccasin] - [/.navajo_white] - [/.navy] - [/.old_lace] - [/.olive] - [/.olive_drab] - [/.orange] - [/.orange_red] - [/.orchid] - [/.pale_goldenrod] - [/.pale_green] - [/.pale_turquoise] - [/.pale_violet_red] - [/.papaya_whip] - [/.peach_puff] - [/.peru] - [/.pink] - [/.plum] - [/.powder_blue] - [/.purple] - [/.rebecca_purple] - [/.red] - [/.rosy_brown] - [/.royal_blue] - [/.saddle_brown] - [/.salmon] - [/.sandy_brown] - [/.sea_green] - [/.sea_shell] - [/.sienna] - [/.silver] - [/.sky_blue] - [/.slate_blue] - [/.slate_gray] - [/.snow] - [/.spring_green] - [/.steel_blue] - [/.tan] - [/.teal] - [/.thistle] - [/.tomato] - [/.turquoise] - [/.violet] - [/.wheat] - [/.white] - [/.white_smoke] - [/.yellow] - [/.yellow_green] - ) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..alice_blue - ..antique_white - ..aqua - ..aquamarine - ..azure - ..beige - ..bisque - ..black - ..blanched_almond - ..blue - ..blue_violet - ..brown - ..burly_wood - ..cadet_blue - ..chartreuse - ..chocolate - ..coral - ..cornflower_blue - ..cornsilk - ..crimson - ..cyan - ..dark_blue - ..dark_cyan - ..dark_goldenrod - ..dark_gray - ..dark_green - ..dark_khaki - ..dark_magenta - ..dark_olive_green - ..dark_orange - ..dark_orchid - ..dark_red - ..dark_salmon - ..dark_sea_green - ..dark_slate_blue - ..dark_slate_gray - ..dark_turquoise - ..dark_violet - ..deep_pink - ..deep_sky_blue - ..dim_gray - ..dodger_blue - ..fire_brick - ..floral_white - ..forest_green - ..fuchsia - ..gainsboro - ..ghost_white - ..gold - ..goldenrod - ..gray - ..green - ..green_yellow - ..honey_dew - ..hot_pink - ..indian_red - ..indigo - ..ivory - ..khaki - ..lavender - ..lavender_blush - ..lawn_green - ..lemon_chiffon - ..light_blue - ..light_coral - ..light_cyan - ..light_goldenrod_yellow - ..light_gray - ..light_green - ..light_pink - ..light_salmon - ..light_sea_green - ..light_sky_blue - ..light_slate_gray - ..light_steel_blue - ..light_yellow - ..lime - ..lime_green - ..linen - ..magenta - ..maroon - ..medium_aquamarine - ..medium_blue - ..medium_orchid - ..medium_purple - ..medium_sea_green - ..medium_slate_blue - ..medium_spring_green - ..medium_turquoise - ..medium_violet_red - ..midnight_blue - ..mint_cream - ..misty_rose - ..moccasin - ..navajo_white - ..navy - ..old_lace - ..olive - ..olive_drab - ..orange - ..orange_red - ..orchid - ..pale_goldenrod - ..pale_green - ..pale_turquoise - ..pale_violet_red - ..papaya_whip - ..peach_puff - ..peru - ..pink - ..plum - ..powder_blue - ..purple - ..rebecca_purple - ..red - ..rosy_brown - ..royal_blue - ..saddle_brown - ..salmon - ..sandy_brown - ..sea_green - ..sea_shell - ..sienna - ..silver - ..sky_blue - ..slate_blue - ..slate_gray - ..snow - ..spring_green - ..steel_blue - ..tan - ..teal - ..thistle - ..tomato - ..turquoise - ..violet - ..wheat - ..white - ..white_smoke - ..yellow - ..yellow_green] - [])) + [/.alice_blue] + [/.antique_white] + [/.aqua] + [/.aquamarine] + [/.azure] + [/.beige] + [/.bisque] + [/.black] + [/.blanched_almond] + [/.blue] + [/.blue_violet] + [/.brown] + [/.burly_wood] + [/.cadet_blue] + [/.chartreuse] + [/.chocolate] + [/.coral] + [/.cornflower_blue] + [/.cornsilk] + [/.crimson] + [/.cyan] + [/.dark_blue] + [/.dark_cyan] + [/.dark_goldenrod] + [/.dark_gray] + [/.dark_green] + [/.dark_khaki] + [/.dark_magenta] + [/.dark_olive_green] + [/.dark_orange] + [/.dark_orchid] + [/.dark_red] + [/.dark_salmon] + [/.dark_sea_green] + [/.dark_slate_blue] + [/.dark_slate_gray] + [/.dark_turquoise] + [/.dark_violet] + [/.deep_pink] + [/.deep_sky_blue] + [/.dim_gray] + [/.dodger_blue] + [/.fire_brick] + [/.floral_white] + [/.forest_green] + [/.fuchsia] + [/.gainsboro] + [/.ghost_white] + [/.gold] + [/.goldenrod] + [/.gray] + [/.green] + [/.green_yellow] + [/.honey_dew] + [/.hot_pink] + [/.indian_red] + [/.indigo] + [/.ivory] + [/.khaki] + [/.lavender] + [/.lavender_blush] + [/.lawn_green] + [/.lemon_chiffon] + [/.light_blue] + [/.light_coral] + [/.light_cyan] + [/.light_goldenrod_yellow] + [/.light_gray] + [/.light_green] + [/.light_pink] + [/.light_salmon] + [/.light_sea_green] + [/.light_sky_blue] + [/.light_slate_gray] + [/.light_steel_blue] + [/.light_yellow] + [/.lime] + [/.lime_green] + [/.linen] + [/.magenta] + [/.maroon] + [/.medium_aquamarine] + [/.medium_blue] + [/.medium_orchid] + [/.medium_purple] + [/.medium_sea_green] + [/.medium_slate_blue] + [/.medium_spring_green] + [/.medium_turquoise] + [/.medium_violet_red] + [/.midnight_blue] + [/.mint_cream] + [/.misty_rose] + [/.moccasin] + [/.navajo_white] + [/.navy] + [/.old_lace] + [/.olive] + [/.olive_drab] + [/.orange] + [/.orange_red] + [/.orchid] + [/.pale_goldenrod] + [/.pale_green] + [/.pale_turquoise] + [/.pale_violet_red] + [/.papaya_whip] + [/.peach_puff] + [/.peru] + [/.pink] + [/.plum] + [/.powder_blue] + [/.purple] + [/.rebecca_purple] + [/.red] + [/.rosy_brown] + [/.royal_blue] + [/.saddle_brown] + [/.salmon] + [/.sandy_brown] + [/.sea_green] + [/.sea_shell] + [/.sienna] + [/.silver] + [/.sky_blue] + [/.slate_blue] + [/.slate_gray] + [/.snow] + [/.spring_green] + [/.steel_blue] + [/.tan] + [/.teal] + [/.thistle] + [/.tomato] + [/.turquoise] + [/.violet] + [/.wheat] + [/.white] + [/.white_smoke] + [/.yellow] + [/.yellow_green] + ))] + []))) diff --git a/stdlib/source/documentation/lux/data/format.lux b/stdlib/source/documentation/lux/data/format.lux index d3e29fdc1..794ebe065 100644 --- a/stdlib/source/documentation/lux/data/format.lux +++ b/stdlib/source/documentation/lux/data/format.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]] diff --git a/stdlib/source/documentation/lux/data/identity.lux b/stdlib/source/documentation/lux/data/identity.lux index f5a0d9589..efb6520f5 100644 --- a/stdlib/source/documentation/lux/data/identity.lux +++ b/stdlib/source/documentation/lux/data/identity.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except nat int rev list or and) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,16 +10,15 @@ [\\library ["[0]" /]]) -(documentation: (/.Identity it) - "A value, as is, without any extra structure super-imposed on it.") - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Identity - ($.default /.functor) + [($.default /.functor) ($.default /.apply) ($.default /.monad) - ($.default /.comonad)] + ($.default /.comonad) + + ($.documentation (/.Identity it) + "A value, as is, without any extra structure super-imposed on it.")] [])) diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux index 05cb3fc80..6a2921eab 100644 --- a/stdlib/source/documentation/lux/data/product.lux +++ b/stdlib/source/documentation/lux/data/product.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except left right) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text ["%" \\format (.only format)]]] @@ -10,43 +10,36 @@ [\\library ["[0]" /]]) -(documentation: /.left - "The left side of a pair.") +(.def .public documentation + (.List $.Module) + ($.module /._ + "Functionality for working with tuples (particularly 2-tuples/pairs)." + [($.default /.equivalence) + ($.default /.hash) -(documentation: /.right - "The right side of a pair.") + ($.documentation /.left + "The left side of a pair.") -(documentation: /.curried - "Converts a 2-argument function into nested single-argument functions." - [(curried f)]) + ($.documentation /.right + "The right side of a pair.") -(documentation: /.uncurried - "Converts nested single-argument functions into a 2-argument function." - [(uncurried f)]) + ($.documentation /.curried + "Converts a 2-argument function into nested single-argument functions." + [(curried f)]) -(documentation: /.swapped - "" - [(swapped [left right])]) + ($.documentation /.uncurried + "Converts nested single-argument functions into a 2-argument function." + [(uncurried f)]) -(documentation: /.then - "Apply functions to both sides of a pair." - [(then f g)]) + ($.documentation /.swapped + "" + [(swapped [left right])]) -(documentation: /.forked - "Yields a pair by applying both functions to a single value." - [(forked f g)]) + ($.documentation /.then + "Apply functions to both sides of a pair." + [(then f g)]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "Functionality for working with tuples (particularly 2-tuples/pairs)." - [..left - ..right - ..curried - ..uncurried - ..swapped - ..then - ..forked - ($.default /.equivalence) - ($.default /.hash)] + ($.documentation /.forked + "Yields a pair by applying both functions to a single value." + [(forked f g)])] [])) diff --git a/stdlib/source/documentation/lux/data/sum.lux b/stdlib/source/documentation/lux/data/sum.lux index f937487f2..cf4df8be5 100644 --- a/stdlib/source/documentation/lux/data/sum.lux +++ b/stdlib/source/documentation/lux/data/sum.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except left right) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,31 +10,27 @@ [\\library ["[0]" /]]) -(documentation: /.left - "Lifts value to the left side of a 2-variant.") - -(documentation: /.right - "Lifts value to the right side of a 2-variant.") - -(documentation: /.either - "Applies a function to either side of a 2-variant." - [(either on_left on_right)]) - -(documentation: /.then - "Applies functions to both sides of a 2-variant." - [(then on_left on_right)]) - (.def .public documentation (.List $.Module) ($.module /._ "Functionality for working with variants (particularly 2-variants)." - [..left - ..right - ..either - ..then - ($.default /.lefts) + [($.default /.lefts) ($.default /.rights) ($.default /.partition) ($.default /.equivalence) - ($.default /.hash)] + ($.default /.hash) + + ($.documentation /.left + "Lifts value to the left side of a 2-variant.") + + ($.documentation /.right + "Lifts value to the right side of a 2-variant.") + + ($.documentation /.either + "Applies a function to either side of a 2-variant." + [(either on_left on_right)]) + + ($.documentation /.then + "Applies functions to both sides of a 2-variant." + [(then on_left on_right)])] [])) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index d8954f75d..d0ca26967 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except char) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text ["%" \\format (.only format)]] @@ -17,124 +17,11 @@ [\\library ["[0]" /]]) -(documentation: /.Char - "A character code number.") - -(documentation: /.line_feed - "Same as 'new_line'.") - -(documentation: /.char - "Yields the character at the specified index." - [(char index input)]) - -(documentation: /.index_since - "" - [(index_since from pattern input)]) - -(documentation: /.index - "" - [(index pattern input)]) - -(documentation: /.last_index - "" - [(last_index part text)]) - -(documentation: /.starts_with? - "" - [(starts_with? prefix x)]) - -(documentation: /.ends_with? - "" - [(ends_with? postfix x)]) - -(documentation: /.enclosed_by? - "" - [(enclosed_by? boundary value)]) - -(documentation: /.contains? - "" - [(contains? sub text)]) - -(documentation: /.prefix - "" - [(prefix param subject)]) - -(documentation: /.suffix - "" - [(suffix param subject)]) - -(documentation: /.enclosed - "Surrounds the given content text with left and right side additions." - [(enclosed [left right] content)]) - -(documentation: /.enclosed' - "Surrounds the given content text with the same boundary text." - [(enclosed' boundary content)]) - -(documentation: /.clip - "Clips a chunk of text from the input at the specified offset and of the specified size." - [(clip offset size input)]) - -(documentation: /.clip_since - "Clips the remaining text from the input at the specified offset." - [(clip_since offset input)]) - -(documentation: /.split_at - "" - [(split_at at x)]) - -(documentation: /.split_by - "" - [(split_by token sample)]) - -(documentation: /.all_split_by - "" - [(all_split_by token sample)]) - -(documentation: /.replaced_once - "" - [(replaced_once pattern replacement template)]) - -(documentation: /.replaced - "" - [(replaced pattern replacement template)]) - -(documentation: /.interposed - "" - [(interposed separator texts)]) - -(documentation: /.space? - "Checks whether the character is white-space." - [(space? char)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Char - ..line_feed - ..char - ..index_since - ..index - ..last_index - ..starts_with? - ..ends_with? - ..enclosed_by? - ..contains? - ..prefix - ..suffix - ..enclosed - ..enclosed' - ..clip - ..clip_since - ..split_at - ..split_by - ..all_split_by - ..replaced_once - ..replaced - ..interposed - ..space? - ($.default /.of_char) + [($.default /.of_char) ($.default /.\0) ($.default /.null) @@ -165,7 +52,97 @@ ($.default /.empty?) ($.default /.space) ($.default /.lower_cased) - ($.default /.upper_cased)] + ($.default /.upper_cased) + + ($.documentation /.Char + "A character code number.") + + ($.documentation /.line_feed + "Same as 'new_line'.") + + ($.documentation /.char + "Yields the character at the specified index." + [(char index input)]) + + ($.documentation /.index_since + "" + [(index_since from pattern input)]) + + ($.documentation /.index + "" + [(index pattern input)]) + + ($.documentation /.last_index + "" + [(last_index part text)]) + + ($.documentation /.starts_with? + "" + [(starts_with? prefix x)]) + + ($.documentation /.ends_with? + "" + [(ends_with? postfix x)]) + + ($.documentation /.enclosed_by? + "" + [(enclosed_by? boundary value)]) + + ($.documentation /.contains? + "" + [(contains? sub text)]) + + ($.documentation /.prefix + "" + [(prefix param subject)]) + + ($.documentation /.suffix + "" + [(suffix param subject)]) + + ($.documentation /.enclosed + "Surrounds the given content text with left and right side additions." + [(enclosed [left right] content)]) + + ($.documentation /.enclosed' + "Surrounds the given content text with the same boundary text." + [(enclosed' boundary content)]) + + ($.documentation /.clip + "Clips a chunk of text from the input at the specified offset and of the specified size." + [(clip offset size input)]) + + ($.documentation /.clip_since + "Clips the remaining text from the input at the specified offset." + [(clip_since offset input)]) + + ($.documentation /.split_at + "" + [(split_at at x)]) + + ($.documentation /.split_by + "" + [(split_by token sample)]) + + ($.documentation /.all_split_by + "" + [(all_split_by token sample)]) + + ($.documentation /.replaced_once + "" + [(replaced_once pattern replacement template)]) + + ($.documentation /.replaced + "" + [(replaced pattern replacement template)]) + + ($.documentation /.interposed + "" + [(interposed separator texts)]) + + ($.documentation /.space? + "Checks whether the character is white-space." + [(space? char)])] [/buffer.documentation /encoding.documentation /escape.documentation diff --git a/stdlib/source/documentation/lux/data/text/buffer.lux b/stdlib/source/documentation/lux/data/text/buffer.lux index 91c41be9f..a510bebab 100644 --- a/stdlib/source/documentation/lux/data/text/buffer.lux +++ b/stdlib/source/documentation/lux/data/text/buffer.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,16 +10,15 @@ [\\library ["[0]" /]]) -(documentation: /.Buffer - "Immutable text buffer for efficient text concatenation.") - (.def .public documentation (.List $.Module) ($.module /._ "" - [..Buffer - ($.default /.empty) + [($.default /.empty) ($.default /.then) ($.default /.size) - ($.default /.text)] + ($.default /.text) + + ($.documentation /.Buffer + "Immutable text buffer for efficient text concatenation.")] [])) diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index 4fd845ff3..fbc82281a 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -12,307 +12,161 @@ ["[0]" / ["[1][0]" utf8]]) -(documentation: /.Encoding - "Encoding formats for text.") +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.name) -(with_template [<name>] - [(documentation: <name> - (format "'" (/.name <name>) "' text encoding. "))] + (documentation: /.Encoding + "Encoding formats for text.") - [/.ascii] + (~~ (with_template [<name>] + [(documentation: <name> + (format "'" (/.name <name>) "' text encoding. "))] - [/.ibm_037] - [/.ibm_273] - [/.ibm_277] - [/.ibm_278] - [/.ibm_280] - [/.ibm_284] - [/.ibm_285] - [/.ibm_290] - [/.ibm_297] - [/.ibm_300] - [/.ibm_420] - [/.ibm_424] - [/.ibm_437] - [/.ibm_500] - [/.ibm_737] - [/.ibm_775] - [/.ibm_833] - [/.ibm_834] - [/.ibm_838] - [/.ibm_850] - [/.ibm_852] - [/.ibm_855] - [/.ibm_856] - [/.ibm_857] - [/.ibm_858] - [/.ibm_860] - [/.ibm_861] - [/.ibm_862] - [/.ibm_863] - [/.ibm_864] - [/.ibm_865] - [/.ibm_866] - [/.ibm_868] - [/.ibm_869] - [/.ibm_870] - [/.ibm_871] - [/.ibm_874] - [/.ibm_875] - [/.ibm_918] - [/.ibm_921] - [/.ibm_922] - [/.ibm_930] - [/.ibm_933] - [/.ibm_935] - [/.ibm_937] - [/.ibm_939] - [/.ibm_942] - [/.ibm_942c] - [/.ibm_943] - [/.ibm_943c] - [/.ibm_948] - [/.ibm_949] - [/.ibm_949c] - [/.ibm_950] - [/.ibm_964] - [/.ibm_970] - [/.ibm_1006] - [/.ibm_1025] - [/.ibm_1026] - [/.ibm_1046] - [/.ibm_1047] - [/.ibm_1097] - [/.ibm_1098] - [/.ibm_1112] - [/.ibm_1122] - [/.ibm_1123] - [/.ibm_1124] - [/.ibm_1140] - [/.ibm_1141] - [/.ibm_1142] - [/.ibm_1143] - [/.ibm_1144] - [/.ibm_1145] - [/.ibm_1146] - [/.ibm_1147] - [/.ibm_1148] - [/.ibm_1149] - [/.ibm_1166] - [/.ibm_1364] - [/.ibm_1381] - [/.ibm_1383] - [/.ibm_33722] - - [/.iso_2022_cn] - [/.iso2022_cn_cns] - [/.iso2022_cn_gb] - [/.iso_2022_jp] - [/.iso_2022_jp_2] - [/.iso_2022_kr] - [/.iso_8859_1] - [/.iso_8859_2] - [/.iso_8859_3] - [/.iso_8859_4] - [/.iso_8859_5] - [/.iso_8859_6] - [/.iso_8859_7] - [/.iso_8859_8] - [/.iso_8859_9] - [/.iso_8859_11] - [/.iso_8859_13] - [/.iso_8859_15] + [/.ascii] - [/.mac_arabic] - [/.mac_central_europe] - [/.mac_croatian] - [/.mac_cyrillic] - [/.mac_dingbat] - [/.mac_greek] - [/.mac_hebrew] - [/.mac_iceland] - [/.mac_roman] - [/.mac_romania] - [/.mac_symbol] - [/.mac_thai] - [/.mac_turkish] - [/.mac_ukraine] - - [/.utf_8] - [/.utf_16] - [/.utf_32] + [/.ibm_037] + [/.ibm_273] + [/.ibm_277] + [/.ibm_278] + [/.ibm_280] + [/.ibm_284] + [/.ibm_285] + [/.ibm_290] + [/.ibm_297] + [/.ibm_300] + [/.ibm_420] + [/.ibm_424] + [/.ibm_437] + [/.ibm_500] + [/.ibm_737] + [/.ibm_775] + [/.ibm_833] + [/.ibm_834] + [/.ibm_838] + [/.ibm_850] + [/.ibm_852] + [/.ibm_855] + [/.ibm_856] + [/.ibm_857] + [/.ibm_858] + [/.ibm_860] + [/.ibm_861] + [/.ibm_862] + [/.ibm_863] + [/.ibm_864] + [/.ibm_865] + [/.ibm_866] + [/.ibm_868] + [/.ibm_869] + [/.ibm_870] + [/.ibm_871] + [/.ibm_874] + [/.ibm_875] + [/.ibm_918] + [/.ibm_921] + [/.ibm_922] + [/.ibm_930] + [/.ibm_933] + [/.ibm_935] + [/.ibm_937] + [/.ibm_939] + [/.ibm_942] + [/.ibm_942c] + [/.ibm_943] + [/.ibm_943c] + [/.ibm_948] + [/.ibm_949] + [/.ibm_949c] + [/.ibm_950] + [/.ibm_964] + [/.ibm_970] + [/.ibm_1006] + [/.ibm_1025] + [/.ibm_1026] + [/.ibm_1046] + [/.ibm_1047] + [/.ibm_1097] + [/.ibm_1098] + [/.ibm_1112] + [/.ibm_1122] + [/.ibm_1123] + [/.ibm_1124] + [/.ibm_1140] + [/.ibm_1141] + [/.ibm_1142] + [/.ibm_1143] + [/.ibm_1144] + [/.ibm_1145] + [/.ibm_1146] + [/.ibm_1147] + [/.ibm_1148] + [/.ibm_1149] + [/.ibm_1166] + [/.ibm_1364] + [/.ibm_1381] + [/.ibm_1383] + [/.ibm_33722] + + [/.iso_2022_cn] + [/.iso2022_cn_cns] + [/.iso2022_cn_gb] + [/.iso_2022_jp] + [/.iso_2022_jp_2] + [/.iso_2022_kr] + [/.iso_8859_1] + [/.iso_8859_2] + [/.iso_8859_3] + [/.iso_8859_4] + [/.iso_8859_5] + [/.iso_8859_6] + [/.iso_8859_7] + [/.iso_8859_8] + [/.iso_8859_9] + [/.iso_8859_11] + [/.iso_8859_13] + [/.iso_8859_15] - [/.windows_31j] - [/.windows_874] - [/.windows_949] - [/.windows_950] - [/.windows_1250] - [/.windows_1252] - [/.windows_1251] - [/.windows_1253] - [/.windows_1254] - [/.windows_1255] - [/.windows_1256] - [/.windows_1257] - [/.windows_1258] - [/.windows_iso2022jp] - [/.windows_50220] - [/.windows_50221] - - [/.cesu_8] - [/.koi8_r] - [/.koi8_u] - ) + [/.mac_arabic] + [/.mac_central_europe] + [/.mac_croatian] + [/.mac_cyrillic] + [/.mac_dingbat] + [/.mac_greek] + [/.mac_hebrew] + [/.mac_iceland] + [/.mac_roman] + [/.mac_romania] + [/.mac_symbol] + [/.mac_thai] + [/.mac_turkish] + [/.mac_ukraine] + + [/.utf_8] + [/.utf_16] + [/.utf_32] -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Encoding - - ..ascii - - ..ibm_037 - ..ibm_273 - ..ibm_277 - ..ibm_278 - ..ibm_280 - ..ibm_284 - ..ibm_285 - ..ibm_290 - ..ibm_297 - ..ibm_300 - ..ibm_420 - ..ibm_424 - ..ibm_437 - ..ibm_500 - ..ibm_737 - ..ibm_775 - ..ibm_833 - ..ibm_834 - ..ibm_838 - ..ibm_850 - ..ibm_852 - ..ibm_855 - ..ibm_856 - ..ibm_857 - ..ibm_858 - ..ibm_860 - ..ibm_861 - ..ibm_862 - ..ibm_863 - ..ibm_864 - ..ibm_865 - ..ibm_866 - ..ibm_868 - ..ibm_869 - ..ibm_870 - ..ibm_871 - ..ibm_874 - ..ibm_875 - ..ibm_918 - ..ibm_921 - ..ibm_922 - ..ibm_930 - ..ibm_933 - ..ibm_935 - ..ibm_937 - ..ibm_939 - ..ibm_942 - ..ibm_942c - ..ibm_943 - ..ibm_943c - ..ibm_948 - ..ibm_949 - ..ibm_949c - ..ibm_950 - ..ibm_964 - ..ibm_970 - ..ibm_1006 - ..ibm_1025 - ..ibm_1026 - ..ibm_1046 - ..ibm_1047 - ..ibm_1097 - ..ibm_1098 - ..ibm_1112 - ..ibm_1122 - ..ibm_1123 - ..ibm_1124 - ..ibm_1140 - ..ibm_1141 - ..ibm_1142 - ..ibm_1143 - ..ibm_1144 - ..ibm_1145 - ..ibm_1146 - ..ibm_1147 - ..ibm_1148 - ..ibm_1149 - ..ibm_1166 - ..ibm_1364 - ..ibm_1381 - ..ibm_1383 - ..ibm_33722 - - ..iso_2022_cn - ..iso2022_cn_cns - ..iso2022_cn_gb - ..iso_2022_jp - ..iso_2022_jp_2 - ..iso_2022_kr - ..iso_8859_1 - ..iso_8859_2 - ..iso_8859_3 - ..iso_8859_4 - ..iso_8859_5 - ..iso_8859_6 - ..iso_8859_7 - ..iso_8859_8 - ..iso_8859_9 - ..iso_8859_11 - ..iso_8859_13 - ..iso_8859_15 - - ..mac_arabic - ..mac_central_europe - ..mac_croatian - ..mac_cyrillic - ..mac_dingbat - ..mac_greek - ..mac_hebrew - ..mac_iceland - ..mac_roman - ..mac_romania - ..mac_symbol - ..mac_thai - ..mac_turkish - ..mac_ukraine - - ..utf_8 - ..utf_16 - ..utf_32 - - ..windows_31j - ..windows_874 - ..windows_949 - ..windows_950 - ..windows_1250 - ..windows_1252 - ..windows_1251 - ..windows_1253 - ..windows_1254 - ..windows_1255 - ..windows_1256 - ..windows_1257 - ..windows_1258 - ..windows_iso2022jp - ..windows_50220 - ..windows_50221 - - ..cesu_8 - ..koi8_r - ..koi8_u - - ($.default /.name)] - [/utf8.documentation])) + [/.windows_31j] + [/.windows_874] + [/.windows_949] + [/.windows_950] + [/.windows_1250] + [/.windows_1252] + [/.windows_1251] + [/.windows_1253] + [/.windows_1254] + [/.windows_1255] + [/.windows_1256] + [/.windows_1257] + [/.windows_1258] + [/.windows_iso2022jp] + [/.windows_50220] + [/.windows_50221] + + [/.cesu_8] + [/.koi8_r] + [/.koi8_u] + ))] + [/utf8.documentation]))) diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux index 6334c936e..0ad760263 100644 --- a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,12 +10,10 @@ [\\library ["[0]" /]]) -(documentation: /.codec - "A codec for binary encoding of text as UTF-8.") - (.def .public documentation (.List $.Module) ($.module /._ "" - [..codec] + [($.documentation /.codec + "A codec for binary encoding of text as UTF-8.")] [])) diff --git a/stdlib/source/documentation/lux/data/text/escape.lux b/stdlib/source/documentation/lux/data/text/escape.lux index 6c39e7373..3a62c1349 100644 --- a/stdlib/source/documentation/lux/data/text/escape.lux +++ b/stdlib/source/documentation/lux/data/text/escape.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,31 +10,28 @@ [\\library ["[0]" /]]) -(documentation: /.escaped - "Yields a escaped version of the text." - [(escaped text)]) - -(documentation: /.un_escaped - (format "Yields an un-escaped text." - \n "Fails if it was improperly escaped.") - [(un_escaped text)]) - -(documentation: /.literal - "If given a escaped text literal, expands to an un-escaped version." - [(/.literal "Line 1\nLine 2") - "=>" - (format "Line 1" \n - "Line 2")]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..escaped - ..un_escaped - ..literal - ($.default /.escapable?) + [($.default /.escapable?) ($.default /.dangling_escape) ($.default /.invalid_escape) - ($.default /.invalid_unicode_escape)] + ($.default /.invalid_unicode_escape) + + ($.documentation /.escaped + "Yields a escaped version of the text." + [(escaped text)]) + + ($.documentation /.un_escaped + (format "Yields an un-escaped text." + \n "Fails if it was improperly escaped.") + [(un_escaped text)]) + + ($.documentation /.literal + "If given a escaped text literal, expands to an un-escaped version." + [(/.literal "Line 1\nLine 2") + "=>" + (format "Line 1" \n + "Line 2")])] [])) diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux index 7d8ecfe97..540acb1fe 100644 --- a/stdlib/source/documentation/lux/data/text/regex.lux +++ b/stdlib/source/documentation/lux/data/text/regex.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except pattern) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,70 +10,68 @@ [\\library ["[0]" /]]) -(documentation: /.regex - "Create lexers using regular-expression syntax." - ["Literals" - (regex "a")] - ["Wildcards" - (regex ".")] - ["Escaping" - (regex "\.")] - ["Character classes" - (regex "\d") - (regex "\p{Lower}") - (regex "[abc]") - (regex "[a-z]") - (regex "[a-zA-Z]") - (regex "[a-z&&[def]]")] - ["Negation" - (regex "[^abc]") - (regex "[^a-z]") - (regex "[^a-zA-Z]") - (regex "[a-z&&[^bc]]") - (regex "[a-z&&[^m-p]]")] - ["Combinations" - (regex "aa") - (regex "a?") - (regex "a*") - (regex "a+")] - ["Specific amounts" - (regex "a{2}")] - ["At least" - (regex "a{1,}")] - ["At most" - (regex "a{,1}")] - ["Between" - (regex "a{1,2}")] - ["Groups" - (regex "a(.)c") - (regex "a(b+)c") - (regex "(\d{3})-(\d{3})-(\d{4})") - (regex "(\d{3})-(?:\d{3})-(\d{4})") - (regex "(?<code>\d{3})-\k<code>-(\d{4})") - (regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") - (regex "(\d{3})-((\d{3})-(\d{4}))")] - ["Alternation" - (regex "a|b") - (regex "a(.)(.)|b(.)(.)")]) - -(documentation: /.pattern - "Allows you to test text against regular expressions." - [(case some_text - (pattern "(\d{3})-(\d{3})-(\d{4})" - [_ country_code area_code place_code]) - do_some_thing_when_number - - (pattern "\w+") - do_some_thing_when_word - - _ - do_something_else)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..regex - ..pattern - ($.default /.incorrect_quantification)] + [($.default /.incorrect_quantification) + + ($.documentation /.regex + "Create lexers using regular-expression syntax." + ["Literals" + (regex "a")] + ["Wildcards" + (regex ".")] + ["Escaping" + (regex "\.")] + ["Character classes" + (regex "\d") + (regex "\p{Lower}") + (regex "[abc]") + (regex "[a-z]") + (regex "[a-zA-Z]") + (regex "[a-z&&[def]]")] + ["Negation" + (regex "[^abc]") + (regex "[^a-z]") + (regex "[^a-zA-Z]") + (regex "[a-z&&[^bc]]") + (regex "[a-z&&[^m-p]]")] + ["Combinations" + (regex "aa") + (regex "a?") + (regex "a*") + (regex "a+")] + ["Specific amounts" + (regex "a{2}")] + ["At least" + (regex "a{1,}")] + ["At most" + (regex "a{,1}")] + ["Between" + (regex "a{1,2}")] + ["Groups" + (regex "a(.)c") + (regex "a(b+)c") + (regex "(\d{3})-(\d{3})-(\d{4})") + (regex "(\d{3})-(?:\d{3})-(\d{4})") + (regex "(?<code>\d{3})-\k<code>-(\d{4})") + (regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") + (regex "(\d{3})-((\d{3})-(\d{4}))")] + ["Alternation" + (regex "a|b") + (regex "a(.)(.)|b(.)(.)")]) + + ($.documentation /.pattern + "Allows you to test text against regular expressions." + [(case some_text + (pattern "(\d{3})-(\d{3})-(\d{4})" + [_ country_code area_code place_code]) + do_some_thing_when_number + + (pattern "\w+") + do_some_thing_when_word + + _ + do_something_else)])] [])) diff --git a/stdlib/source/documentation/lux/data/text/unicode.lux b/stdlib/source/documentation/lux/data/text/unicode.lux index 0888ceaf6..6248d9bb9 100644 --- a/stdlib/source/documentation/lux/data/text/unicode.lux +++ b/stdlib/source/documentation/lux/data/text/unicode.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text ["%" \\format (.only format)]] diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index cf745fd9f..95868365e 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text ["%" \\format (.only format)]]] @@ -13,253 +13,142 @@ [\\library ["[0]" /]]) -(documentation: /.Block - "A block of valid unicode characters.") +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.monoid) + ($.default /.start) + ($.default /.end) + ($.default /.size) + ($.default /.equivalence) + ($.default /.hash) -(documentation: /.block - "" - [(block start additional)]) + ($.documentation /.Block + "A block of valid unicode characters.") -(documentation: /.within? - "" - [(within? block char)]) + ($.documentation /.block + "" + [(block start additional)]) -(with_template [<name>] - [(documentation: <name> - (let [[_ name] (symbol <name>)] - (format (hex#encoded (/.start <name>)) - "-" (hex#encoded (/.end <name>)) - " | " (text.replaced "_" " " name))))] + ($.documentation /.within? + "" + [(within? block char)]) - [/.basic_latin] - [/.latin_1_supplement] - [/.latin_extended_a] - [/.latin_extended_b] - [/.ipa_extensions] - [/.spacing_modifier_letters] - [/.combining_diacritical_marks] - [/.greek_and_coptic] - [/.cyrillic] - [/.cyrillic_supplementary] - [/.armenian] - [/.hebrew] - [/.arabic] - [/.syriac] - [/.thaana] - [/.devanagari] - [/.bengali] - [/.gurmukhi] - [/.gujarati] - [/.oriya] - [/.tamil] - [/.telugu] - [/.kannada] - [/.malayalam] - [/.sinhala] - [/.thai] - [/.lao] - [/.tibetan] - [/.myanmar] - [/.georgian] - [/.hangul_jamo] - [/.ethiopic] - [/.cherokee] - [/.unified_canadian_aboriginal_syllabics] - [/.ogham] - [/.runic] - [/.tagalog] - [/.hanunoo] - [/.buhid] - [/.tagbanwa] - [/.khmer] - [/.mongolian] - [/.limbu] - [/.tai_le] - [/.khmer_symbols] - [/.phonetic_extensions] - [/.latin_extended_additional] - [/.greek_extended] - [/.general_punctuation] - [/.superscripts_and_subscripts] - [/.currency_symbols] - [/.combining_diacritical_marks_for_symbols] - [/.letterlike_symbols] - [/.number_forms] - [/.arrows] - [/.mathematical_operators] - [/.miscellaneous_technical] - [/.control_pictures] - [/.optical_character_recognition] - [/.enclosed_alphanumerics] - [/.box_drawing] - [/.block_elements] - [/.geometric_shapes] - [/.miscellaneous_symbols] - [/.dingbats] - [/.miscellaneous_mathematical_symbols_a] - [/.supplemental_arrows_a] - [/.braille_patterns] - [/.supplemental_arrows_b] - [/.miscellaneous_mathematical_symbols_b] - [/.supplemental_mathematical_operators] - [/.miscellaneous_symbols_and_arrows] - [/.cjk_radicals_supplement] - [/.kangxi_radicals] - [/.ideographic_description_characters] - [/.cjk_symbols_and_punctuation] - [/.hiragana] - [/.katakana] - [/.bopomofo] - [/.hangul_compatibility_jamo] - [/.kanbun] - [/.bopomofo_extended] - [/.katakana_phonetic_extensions] - [/.enclosed_cjk_letters_and_months] - [/.cjk_compatibility] - [/.cjk_unified_ideographs_extension_a] - [/.yijing_hexagram_symbols] - [/.cjk_unified_ideographs] - [/.yi_syllables] - [/.yi_radicals] - [/.hangul_syllables] - [/.high_surrogates] - [/.high_private_use_surrogates] - [/.low_surrogates] - [/.private_use_area] - [/.cjk_compatibility_ideographs] - [/.alphabetic_presentation_forms] - [/.arabic_presentation_forms_a] - [/.variation_selectors] - [/.combining_half_marks] - [/.cjk_compatibility_forms] - [/.small_form_variants] - [/.arabic_presentation_forms_b] - [/.halfwidth_and_fullwidth_forms] - [/.specials] - [/.numeric] - [/.upper_case] - [/.lower_case] - ) + (~~ (with_template [<name>] + [($.documentation <name> + (let [[_ name] (symbol <name>)] + (format (hex#encoded (/.start <name>)) + "-" (hex#encoded (/.end <name>)) + " | " (text.replaced "_" " " name))))] -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Block - ..block - ..within? - ..basic_latin - ..latin_1_supplement - ..latin_extended_a - ..latin_extended_b - ..ipa_extensions - ..spacing_modifier_letters - ..combining_diacritical_marks - ..greek_and_coptic - ..cyrillic - ..cyrillic_supplementary - ..armenian - ..hebrew - ..arabic - ..syriac - ..thaana - ..devanagari - ..bengali - ..gurmukhi - ..gujarati - ..oriya - ..tamil - ..telugu - ..kannada - ..malayalam - ..sinhala - ..thai - ..lao - ..tibetan - ..myanmar - ..georgian - ..hangul_jamo - ..ethiopic - ..cherokee - ..unified_canadian_aboriginal_syllabics - ..ogham - ..runic - ..tagalog - ..hanunoo - ..buhid - ..tagbanwa - ..khmer - ..mongolian - ..limbu - ..tai_le - ..khmer_symbols - ..phonetic_extensions - ..latin_extended_additional - ..greek_extended - ..general_punctuation - ..superscripts_and_subscripts - ..currency_symbols - ..combining_diacritical_marks_for_symbols - ..letterlike_symbols - ..number_forms - ..arrows - ..mathematical_operators - ..miscellaneous_technical - ..control_pictures - ..optical_character_recognition - ..enclosed_alphanumerics - ..box_drawing - ..block_elements - ..geometric_shapes - ..miscellaneous_symbols - ..dingbats - ..miscellaneous_mathematical_symbols_a - ..supplemental_arrows_a - ..braille_patterns - ..supplemental_arrows_b - ..miscellaneous_mathematical_symbols_b - ..supplemental_mathematical_operators - ..miscellaneous_symbols_and_arrows - ..cjk_radicals_supplement - ..kangxi_radicals - ..ideographic_description_characters - ..cjk_symbols_and_punctuation - ..hiragana - ..katakana - ..bopomofo - ..hangul_compatibility_jamo - ..kanbun - ..bopomofo_extended - ..katakana_phonetic_extensions - ..enclosed_cjk_letters_and_months - ..cjk_compatibility - ..cjk_unified_ideographs_extension_a - ..yijing_hexagram_symbols - ..cjk_unified_ideographs - ..yi_syllables - ..yi_radicals - ..hangul_syllables - ..high_surrogates - ..high_private_use_surrogates - ..low_surrogates - ..private_use_area - ..cjk_compatibility_ideographs - ..alphabetic_presentation_forms - ..arabic_presentation_forms_a - ..variation_selectors - ..combining_half_marks - ..cjk_compatibility_forms - ..small_form_variants - ..arabic_presentation_forms_b - ..halfwidth_and_fullwidth_forms - ..specials - ..numeric - ..upper_case - ..lower_case - ($.default /.monoid) - ($.default /.start) - ($.default /.end) - ($.default /.size) - ($.default /.equivalence) - ($.default /.hash)] - [])) + [/.basic_latin] + [/.latin_1_supplement] + [/.latin_extended_a] + [/.latin_extended_b] + [/.ipa_extensions] + [/.spacing_modifier_letters] + [/.combining_diacritical_marks] + [/.greek_and_coptic] + [/.cyrillic] + [/.cyrillic_supplementary] + [/.armenian] + [/.hebrew] + [/.arabic] + [/.syriac] + [/.thaana] + [/.devanagari] + [/.bengali] + [/.gurmukhi] + [/.gujarati] + [/.oriya] + [/.tamil] + [/.telugu] + [/.kannada] + [/.malayalam] + [/.sinhala] + [/.thai] + [/.lao] + [/.tibetan] + [/.myanmar] + [/.georgian] + [/.hangul_jamo] + [/.ethiopic] + [/.cherokee] + [/.unified_canadian_aboriginal_syllabics] + [/.ogham] + [/.runic] + [/.tagalog] + [/.hanunoo] + [/.buhid] + [/.tagbanwa] + [/.khmer] + [/.mongolian] + [/.limbu] + [/.tai_le] + [/.khmer_symbols] + [/.phonetic_extensions] + [/.latin_extended_additional] + [/.greek_extended] + [/.general_punctuation] + [/.superscripts_and_subscripts] + [/.currency_symbols] + [/.combining_diacritical_marks_for_symbols] + [/.letterlike_symbols] + [/.number_forms] + [/.arrows] + [/.mathematical_operators] + [/.miscellaneous_technical] + [/.control_pictures] + [/.optical_character_recognition] + [/.enclosed_alphanumerics] + [/.box_drawing] + [/.block_elements] + [/.geometric_shapes] + [/.miscellaneous_symbols] + [/.dingbats] + [/.miscellaneous_mathematical_symbols_a] + [/.supplemental_arrows_a] + [/.braille_patterns] + [/.supplemental_arrows_b] + [/.miscellaneous_mathematical_symbols_b] + [/.supplemental_mathematical_operators] + [/.miscellaneous_symbols_and_arrows] + [/.cjk_radicals_supplement] + [/.kangxi_radicals] + [/.ideographic_description_characters] + [/.cjk_symbols_and_punctuation] + [/.hiragana] + [/.katakana] + [/.bopomofo] + [/.hangul_compatibility_jamo] + [/.kanbun] + [/.bopomofo_extended] + [/.katakana_phonetic_extensions] + [/.enclosed_cjk_letters_and_months] + [/.cjk_compatibility] + [/.cjk_unified_ideographs_extension_a] + [/.yijing_hexagram_symbols] + [/.cjk_unified_ideographs] + [/.yi_syllables] + [/.yi_radicals] + [/.hangul_syllables] + [/.high_surrogates] + [/.high_private_use_surrogates] + [/.low_surrogates] + [/.private_use_area] + [/.cjk_compatibility_ideographs] + [/.alphabetic_presentation_forms] + [/.arabic_presentation_forms_a] + [/.variation_selectors] + [/.combining_half_marks] + [/.cjk_compatibility_forms] + [/.small_form_variants] + [/.arabic_presentation_forms_b] + [/.halfwidth_and_fullwidth_forms] + [/.specials] + [/.numeric] + [/.upper_case] + [/.lower_case] + ))] + []))) diff --git a/stdlib/source/documentation/lux/data/text/unicode/set.lux b/stdlib/source/documentation/lux/data/text/unicode/set.lux index e5b0a3bf8..80f96be50 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/set.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/set.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text ["%" \\format (.only format)]]] @@ -10,21 +10,11 @@ [\\library ["[0]" /]]) -(documentation: /.set - "" - [(set [head tail])]) - -(documentation: /.member? - "" - [(member? set character)]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..set - ..member? - ($.default /.Set) + [($.default /.Set) ($.default /.composite) ($.default /.character) ($.default /.non_character) @@ -38,5 +28,13 @@ ($.default /.alpha_numeric) ($.default /.numeric) ($.default /.upper_case) - ($.default /.lower_case)] + ($.default /.lower_case) + + ($.documentation /.set + "" + [(set [head tail])]) + + ($.documentation /.member? + "" + [(member? set character)])] [])) diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index 1379b60a3..5dd79df31 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -20,7 +20,7 @@ [language [lux [phase - ["[0]" directive]]]]]]]] + ["[0]" declaration]]]]]]]] [\\library ["[0]" /]]) @@ -43,12 +43,12 @@ (phase archive pass_through)) (phase archive pass_through)))]) -(documentation: /.directive +(documentation: /.declaration "" - [(directive ("my directive" self phase archive [parameters (<>.some <code>.any)]) - (do phase.monad - [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] - (in directive.no_requirements)))]) + [(declaration ("my declaration" self phase archive [parameters (<>.some <code>.any)]) + (do phase.monad + [.let [_ (debug.log! (format "Successfully installed declaration " (%.text self) "!"))]] + (in declaration.no_requirements)))]) (.def .public documentation (.List $.Module) @@ -57,5 +57,5 @@ [..analysis ..synthesis ..generation - ..directive] + ..declaration] [])) diff --git a/stdlib/source/documentation/lux/macro/local.lux b/stdlib/source/documentation/lux/macro/local.lux index bb4a4099f..a6256aa92 100644 --- a/stdlib/source/documentation/lux/macro/local.lux +++ b/stdlib/source/documentation/lux/macro/local.lux @@ -12,7 +12,7 @@ (documentation: /.push (format "Installs macros in the compiler-state, with the given names." - \n "Yields code that can be placed either as expression or as directives." + \n "Yields code that can be placed either as expression or as declarations." \n "This code un-installs the macros." \n "NOTE: Always use this code once to clean-up..") [(push macros)]) diff --git a/stdlib/source/documentation/lux/tool.lux b/stdlib/source/documentation/lux/tool.lux index 4983fe8ea..77877d5d1 100644 --- a/stdlib/source/documentation/lux/tool.lux +++ b/stdlib/source/documentation/lux/tool.lux @@ -13,7 +13,7 @@ [language [lux ["[1][0]" analysis] - ["[1][0]" directive] + ["[1][0]" declaration] ["[1][0]" generation] ["[1][0]" synthesis]]]]]) @@ -22,7 +22,7 @@ (list.together (list /phase.documentation /analysis.documentation - /directive.documentation + /declaration.documentation /generation.documentation /synthesis.documentation ))) diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/declaration.lux index ff1036122..ff1036122 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/declaration.lux diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux index c0cb068f2..4b29c8ad0 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux @@ -51,7 +51,7 @@ ($.default /.learn_analyser) ($.default /.learn_synthesizer) ($.default /.learn_generator) - ($.default /.learn_directive) + ($.default /.learn_declaration) ($.default /.unknown_definition) ($.default /.remember) ($.default /.no_context) diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index 9c3946a30..cfa13af9b 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -31,7 +31,7 @@ #archive Text #inputs (List Code)])) -(def (declaration default) +(def (declarationP default) (-> Code (Parser Declaration)) (<c>.form (all <>.and <c>.any @@ -42,7 +42,7 @@ (with_template [<any> <end> <and> <result> <extension> <name>] [(def .public <name> - (syntax (_ [[name extension phase archive inputs] (..declaration (` <any>)) + (syntax (_ [[name extension phase archive inputs] (..declarationP (` <any>)) body <c>.any]) (let [g!name (code.local extension) g!phase (code.local phase) @@ -66,5 +66,5 @@ [<c>.any <c>.end <c>.and <c>.result "lux def analysis" analysis] [<a>.any <a>.end <a>.and <a>.result "lux def synthesis" synthesis] [<s>.any <s>.end <s>.and <s>.result "lux def generation" generation] - [<c>.any <c>.end <c>.and <c>.result "lux def directive" directive] + [<c>.any <c>.end <c>.and <c>.result "lux def declaration" declaration] ) diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index e40ea1964..a887d9f84 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [extension (.only directive)] + [extension (.only declaration)] ["[0]" meta] ["[0]" static] [abstract @@ -32,7 +32,7 @@ [language [lux ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] [analysis ["[0]" type]]]]]]]]) @@ -49,41 +49,41 @@ (with_expansions [<extension> (static.random (|>> %.nat (%.format "lua export ") code.text) random.nat)] - (directive (<extension> self phase archive [name <code>.text - term <code>.any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration (<extension> self phase archive [name <code>.text + term <code>.any]) + (do [! phase.monad] + [next declaration.analysis + [_ term] (<| declaration.lifted_analysis + type.inferring + (next archive term)) - next directive.synthesis - term (directive.lifted_synthesis - (next archive term)) + next declaration.synthesis + term (declaration.lifted_synthesis + (next archive term)) - dependencies (directive.lifted_generation - (dependency.dependencies archive term)) + dependencies (declaration.lifted_generation + (dependency.dependencies archive term)) - next directive.generation - [interim_artifacts term] (directive.lifted_generation - (generation.with_interim_artifacts archive - (next archive term))) + next declaration.generation + [interim_artifacts term] (declaration.lifted_generation + (generation.with_interim_artifacts archive + (next archive term))) - _ (directive.lifted_generation - (do ! - [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) - .let [$module (/.var "module") - $exports (/.the "exports" $module) - definition (/.define (/.var name) term) - export (/.when (/.not (/.= (/.string "undefined") (/.type_of $module))) - (/.set (/.the name $exports) (/.var name))) - code (all /.then - definition - export)] - _ (generation.execute! definition) - _ (generation.save! @self {.#None} code)] - (generation.log! (%.format "Export " (%.text name)))))] - (in directive.no_requirements))) + _ (declaration.lifted_generation + (do ! + [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) + .let [$module (/.var "module") + $exports (/.the "exports" $module) + definition (/.define (/.var name) term) + export (/.when (/.not (/.= (/.string "undefined") (/.type_of $module))) + (/.set (/.the name $exports) (/.var name))) + code (all /.then + definition + export)] + _ (generation.execute! definition) + _ (generation.save! @self {.#None} code)] + (generation.log! (%.format "Export " (%.text name)))))] + (in declaration.no_requirements))) (def .public export (syntax (_ [exports (<>.many <code>.any)]) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index 66b98998d..c38eaf711 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [extension (.only directive)] + [extension (.only declaration)] ["[0]" meta] ["[0]" static] [abstract @@ -32,7 +32,7 @@ [language [lux ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] [analysis ["[0]" type]]]]]]]]) @@ -53,53 +53,53 @@ (with_expansions [<extension> (static.random (|>> %.nat (%.format "lua export ") code.text) random.nat)] - (directive (<extension> self phase archive [name <code>.text - term <code>.any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration (<extension> self phase archive [name <code>.text + term <code>.any]) + (do [! phase.monad] + [next declaration.analysis + [_ term] (<| declaration.lifted_analysis + type.inferring + (next archive term)) - next directive.synthesis - term (directive.lifted_synthesis - (next archive term)) + next declaration.synthesis + term (declaration.lifted_synthesis + (next archive term)) - dependencies (directive.lifted_generation - (dependency.dependencies archive term)) + dependencies (declaration.lifted_generation + (dependency.dependencies archive term)) - next directive.generation - [interim_artifacts term] (directive.lifted_generation - (generation.with_interim_artifacts archive - (next archive term))) + next declaration.generation + [interim_artifacts term] (declaration.lifted_generation + (generation.with_interim_artifacts archive + (next archive term))) - _ (directive.lifted_generation - (do ! - [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) - .let [$exports (/.var "_REQUIREDNAME") - $global (/.var "_G") - exporting? (/.not (/.= /.nil $exports)) - no_exports? (/.= /.nil (/.item $exports $global)) - initialize_exports! (/.set (list (/.item $exports $global)) (/.table (list))) - export_definition! (/.set (|> $global - (/.item $exports) - (/.item (/.string name)) - (list)) - (/.var name)) - export! (/.when exporting? - (all /.then - (/.when no_exports? - initialize_exports!) - export_definition! - ))] - _ (generation.execute! (all /.then - (/.set (list (/.var name)) term) - export!)) - _ (generation.save! @self {.#None} (all /.then - (/.local/1 (/.var name) term) - export!))] - (generation.log! (%.format "Export " (%.text name)))))] - (in directive.no_requirements))) + _ (declaration.lifted_generation + (do ! + [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) + .let [$exports (/.var "_REQUIREDNAME") + $global (/.var "_G") + exporting? (/.not (/.= /.nil $exports)) + no_exports? (/.= /.nil (/.item $exports $global)) + initialize_exports! (/.set (list (/.item $exports $global)) (/.table (list))) + export_definition! (/.set (|> $global + (/.item $exports) + (/.item (/.string name)) + (list)) + (/.var name)) + export! (/.when exporting? + (all /.then + (/.when no_exports? + initialize_exports!) + export_definition! + ))] + _ (generation.execute! (all /.then + (/.set (list (/.var name)) term) + export!)) + _ (generation.save! @self {.#None} (all /.then + (/.local/1 (/.var name) term) + export!))] + (generation.log! (%.format "Export " (%.text name)))))] + (in declaration.no_requirements))) (def .public export (syntax (_ [exports (<>.many <code>.any)]) diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 42309927e..be61ff11e 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - [extension (.only directive)] + [extension (.only declaration)] ["[0]" meta] ["[0]" static] [abstract @@ -32,7 +32,7 @@ [language [lux ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] [analysis ["[0]" type]]]]]]]]) @@ -49,34 +49,34 @@ (with_expansions [<extension> (static.random (|>> %.nat (%.format "python export ") code.text) random.nat)] - (directive (<extension> self phase archive [name <code>.text - term <code>.any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration (<extension> self phase archive [name <code>.text + term <code>.any]) + (do [! phase.monad] + [next declaration.analysis + [_ term] (<| declaration.lifted_analysis + type.inferring + (next archive term)) - next directive.synthesis - term (directive.lifted_synthesis - (next archive term)) + next declaration.synthesis + term (declaration.lifted_synthesis + (next archive term)) - dependencies (directive.lifted_generation - (dependency.dependencies archive term)) + dependencies (declaration.lifted_generation + (dependency.dependencies archive term)) - next directive.generation - [interim_artifacts term] (directive.lifted_generation - (generation.with_interim_artifacts archive - (next archive term))) + next declaration.generation + [interim_artifacts term] (declaration.lifted_generation + (generation.with_interim_artifacts archive + (next archive term))) - _ (directive.lifted_generation - (do ! - [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) - .let [code (/.set (list (/.item (/.string name) /.globals/0)) term)] - _ (generation.execute! code) - _ (generation.save! @self {.#None} code)] - (generation.log! (%.format "Export " (%.text name)))))] - (in directive.no_requirements))) + _ (declaration.lifted_generation + (do ! + [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) + .let [code (/.set (list (/.item (/.string name) /.globals/0)) term)] + _ (generation.execute! code) + _ (generation.save! @self {.#None} code)] + (generation.log! (%.format "Export " (%.text name)))))] + (in declaration.no_requirements))) (def .public export (syntax (_ [exports (<>.many <code>.any)]) diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index 6777bfa86..b29982a1c 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except global) - [extension (.only directive)] + [extension (.only declaration)] ["[0]" meta] ["[0]" static] ["[0]" type] @@ -34,7 +34,7 @@ [language [lux ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] ["[0]" analysis ["[1]" type]]]]]]]]) @@ -87,45 +87,45 @@ (with_expansions [<extension> (static.random (|>> %.nat (%.format "ruby export ") code.text) random.nat)] - (directive (<extension> self phase archive [global? <code>.bit - name <code>.text - term <code>.any]) - (do [! phase.monad] - [next directive.analysis - [type term] (<| directive.lifted_analysis - analysis.inferring - (next archive term)) + (declaration (<extension> self phase archive [global? <code>.bit + name <code>.text + term <code>.any]) + (do [! phase.monad] + [next declaration.analysis + [type term] (<| declaration.lifted_analysis + analysis.inferring + (next archive term)) - next directive.synthesis - term (directive.lifted_synthesis - (next archive term)) + next declaration.synthesis + term (declaration.lifted_synthesis + (next archive term)) - dependencies (directive.lifted_generation - (dependency.dependencies archive term)) + dependencies (declaration.lifted_generation + (dependency.dependencies archive term)) - next directive.generation - [interim_artifacts term] (directive.lifted_generation - (generation.with_interim_artifacts archive - (next archive term))) + next declaration.generation + [interim_artifacts term] (declaration.lifted_generation + (generation.with_interim_artifacts archive + (next archive term))) - _ (directive.lifted_generation - (do ! - [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) - .let [[:input:/* :output:] (type.flat_function type) - code (if global? - (/.set (list (/.manual name)) term) - (case :input:/* - {.#End} - (/.function (/.manual name) (list) - (/.return term)) + _ (declaration.lifted_generation + (do ! + [@self (generation.learn_custom name (list#mix set.has dependencies interim_artifacts)) + .let [[:input:/* :output:] (type.flat_function type) + code (if global? + (/.set (list (/.manual name)) term) + (case :input:/* + {.#End} + (/.function (/.manual name) (list) + (/.return term)) - _ - (/.statement (/.apply (list (/.string name) term) {.#None} - (/.manual "define_method")))))] - _ (generation.execute! code) - _ (generation.save! @self {.#None} code)] - (generation.log! (%.format "Export " (%.text name)))))] - (in directive.no_requirements))) + _ + (/.statement (/.apply (list (/.string name) term) {.#None} + (/.manual "define_method")))))] + _ (generation.execute! code) + _ (generation.save! @self {.#None} code)] + (generation.log! (%.format "Export " (%.text name)))))] + (in declaration.no_requirements))) (def .public export (syntax (_ [exports (<>.many <code>.any)]) diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 4922fd23e..7a5bdebc0 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive parameter) + [lux (.except Primitive parameter type) ["[0]" ffi (.only import)] ["[0]" type] [abstract diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index b68215990..6f2ab6b47 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Primitive int char parameter) + [lux (.except Primitive int char parameter type) [abstract ["[0]" monad (.only do)]] [control @@ -16,7 +16,7 @@ ["[0]" array] ["[0]" dictionary (.only Dictionary)]]] [type - [primitive (.except)] + [":" primitive] ["[0]" check (.only Check) (.use "[1]#[0]" monad)]]]] ["[0]" // (.only) [category (.only Void Value Return Method Primitive Object Class Array Var Parameter)] @@ -30,12 +30,13 @@ ["[1][0]" name]]]]) (with_template [<name>] - [(primitive .public (<name> class) Any)] + [(:.primitive .public (<name> class) Any)] - [Lower] [Upper] + [Lower] + [Upper] ) -(type .public Mapping +(.type .public Mapping (Dictionary Text Type)) (def .public fresh @@ -186,10 +187,10 @@ [//reflection.double] [//reflection.char])))) {.#Primitive (|> name //reflection.class //reflection.array //reflection.reflection) {.#End}} - (|> elementT array.Array .type)) + (|> elementT array.Array type_literal)) _ - (|> elementT array.Array .type))))) + (|> elementT array.Array type_literal))))) (<>.after (<text>.this //descriptor.array_prefix)))) (def .public (type mapping) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index f9c201df1..f966f9b63 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -31,7 +31,7 @@ [program (.only Program)] ["[1][0]" syntax (.only Aliases)] ["[1][0]" synthesis] - ["[1][0]" directive (.only Requirements)] + ["[1][0]" declaration (.only Requirements)] ["[1][0]" generation] ["[1][0]" analysis (.only) [macro (.only Expander)] @@ -40,11 +40,11 @@ [phase ["[0]P" analysis] ["[0]P" synthesis] - ["[0]P" directive] + ["[0]P" declaration] ["[0]" extension (.only Extender) ["[0]E" analysis] ["[0]E" synthesis] - [directive + [declaration ["[0]D" lux]]]]]] [meta ["[0]" archive (.only Archive) @@ -54,41 +54,41 @@ ["[0]" document]]]]]]) (def .public (state target module configuration expander host_analysis host generate generation_bundle) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Target descriptor.Module Configuration Expander ///analysis.Bundle - (///generation.Host expression directive) - (///generation.Phase anchor expression directive) - (///generation.Bundle anchor expression directive) - (///directive.State+ anchor expression directive))) + (///generation.Host expression declaration) + (///generation.Phase anchor expression declaration) + (///generation.Bundle anchor expression declaration) + (///declaration.State+ anchor expression declaration))) (let [synthesis_state [synthesisE.bundle ///synthesis.init] generation_state [generation_bundle (///generation.state host module)] eval (///analysis/evaluation.evaluator expander synthesis_state generation_state generate) analysis_state [(analysisE.bundle eval host_analysis) (///analysis.state (///analysis.info version.latest target configuration))]] [extension.empty - [///directive.#analysis [///directive.#state analysis_state - ///directive.#phase (analysisP.phase expander)] - ///directive.#synthesis [///directive.#state synthesis_state - ///directive.#phase synthesisP.phase] - ///directive.#generation [///directive.#state generation_state - ///directive.#phase generate]]])) + [///declaration.#analysis [///declaration.#state analysis_state + ///declaration.#phase (analysisP.phase expander)] + ///declaration.#synthesis [///declaration.#state synthesis_state + ///declaration.#phase synthesisP.phase] + ///declaration.#generation [///declaration.#state generation_state + ///declaration.#phase generate]]])) -(def .public (with_default_directives expander host_analysis program anchorT,expressionT,directiveT extender) - (All (_ anchor expression directive) +(def .public (with_default_declarations expander host_analysis program anchorT,expressionT,declarationT extender) + (All (_ anchor expression declaration) (-> Expander ///analysis.Bundle - (Program expression directive) + (Program expression declaration) [Type Type Type] Extender - (-> (///directive.State+ anchor expression directive) - (///directive.State+ anchor expression directive)))) - (function (_ [directive_extensions sub_state]) - [(dictionary.composite directive_extensions - (luxD.bundle expander host_analysis program anchorT,expressionT,directiveT extender)) + (-> (///declaration.State+ anchor expression declaration) + (///declaration.State+ anchor expression declaration)))) + (function (_ [declaration_extensions sub_state]) + [(dictionary.composite declaration_extensions + (luxD.bundle expander host_analysis program anchorT,expressionT,declarationT extender)) sub_state])) (type Reader @@ -115,22 +115,22 @@ [source' output]]})))) (type (Operation a) - (All (_ anchor expression directive) - (///directive.Operation anchor expression directive a))) + (All (_ anchor expression declaration) + (///declaration.Operation anchor expression declaration a))) -(type (Payload directive) - [(///generation.Buffer directive) +(type (Payload declaration) + [(///generation.Buffer declaration) Registry]) (def (begin dependencies hash input) (-> (List descriptor.Module) Nat ///.Input - (All (_ anchor expression directive) - (///directive.Operation anchor expression directive - [Source (Payload directive)]))) + (All (_ anchor expression declaration) + (///declaration.Operation anchor expression declaration + [Source (Payload declaration)]))) (do ///phase.monad [.let [module (the ///.#module input)] - _ (///directive.set_current_module module)] - (///directive.lifted_analysis + _ (///declaration.set_current_module module)] + (///declaration.lifted_analysis (do [! ///phase.monad] [_ (moduleA.create hash module) _ (monad.each ! moduleA.import dependencies) @@ -141,74 +141,74 @@ (def (end module) (-> descriptor.Module - (All (_ anchor expression directive) - (///directive.Operation anchor expression directive [.Module (Payload directive)]))) + (All (_ anchor expression declaration) + (///declaration.Operation anchor expression declaration [.Module (Payload declaration)]))) (do ///phase.monad - [_ (///directive.lifted_analysis + [_ (///declaration.lifted_analysis (moduleA.set_compiled module)) analysis_module (<| (is (Operation .Module)) - ///directive.lifted_analysis + ///declaration.lifted_analysis extension.lifted meta.current_module) - final_buffer (///directive.lifted_generation + final_buffer (///declaration.lifted_generation ///generation.buffer) - final_registry (///directive.lifted_generation + final_registry (///declaration.lifted_generation ///generation.get_registry)] (in [analysis_module [final_buffer final_registry]]))) ... TODO: Inline ASAP (def (get_current_payload _) - (All (_ directive) - (-> (Payload directive) + (All (_ declaration) + (-> (Payload declaration) (All (_ anchor expression) - (///directive.Operation anchor expression directive - (Payload directive))))) + (///declaration.Operation anchor expression declaration + (Payload declaration))))) (do ///phase.monad - [buffer (///directive.lifted_generation + [buffer (///declaration.lifted_generation ///generation.buffer) - registry (///directive.lifted_generation + registry (///declaration.lifted_generation ///generation.get_registry)] (in [buffer registry]))) ... TODO: Inline ASAP -(def (process_directive wrapper archive expander pre_payoad code) - (All (_ directive) - (-> ///phase.Wrapper Archive Expander (Payload directive) Code +(def (process_declaration wrapper archive expander pre_payoad code) + (All (_ declaration) + (-> ///phase.Wrapper Archive Expander (Payload declaration) Code (All (_ anchor expression) - (///directive.Operation anchor expression directive - [Requirements (Payload directive)])))) + (///declaration.Operation anchor expression declaration + [Requirements (Payload declaration)])))) (do ///phase.monad [.let [[pre_buffer pre_registry] pre_payoad] - _ (///directive.lifted_generation + _ (///declaration.lifted_generation (///generation.set_buffer pre_buffer)) - _ (///directive.lifted_generation + _ (///declaration.lifted_generation (///generation.set_registry pre_registry)) - requirements (let [execute! (directiveP.phase wrapper expander)] + requirements (let [execute! (declarationP.phase wrapper expander)] (execute! archive code)) post_payload (..get_current_payload pre_payoad)] (in [requirements post_payload]))) (def (iteration' wrapper archive expander reader source pre_payload) - (All (_ directive) - (-> ///phase.Wrapper Archive Expander Reader Source (Payload directive) + (All (_ declaration) + (-> ///phase.Wrapper Archive Expander Reader Source (Payload declaration) (All (_ anchor expression) - (///directive.Operation anchor expression directive - [Source Requirements (Payload directive)])))) + (///declaration.Operation anchor expression declaration + [Source Requirements (Payload declaration)])))) (do ///phase.monad - [[source code] (///directive.lifted_analysis + [[source code] (///declaration.lifted_analysis (..read source reader)) - [requirements post_payload] (process_directive wrapper archive expander pre_payload code)] + [requirements post_payload] (process_declaration wrapper archive expander pre_payload code)] (in [source requirements post_payload]))) (def (iteration wrapper archive expander module source pre_payload aliases) - (All (_ directive) - (-> ///phase.Wrapper Archive Expander descriptor.Module Source (Payload directive) Aliases + (All (_ declaration) + (-> ///phase.Wrapper Archive Expander descriptor.Module Source (Payload declaration) Aliases (All (_ anchor expression) - (///directive.Operation anchor expression directive - (Maybe [Source Requirements (Payload directive)]))))) + (///declaration.Operation anchor expression declaration + (Maybe [Source Requirements (Payload declaration)]))))) (do ///phase.monad - [reader (///directive.lifted_analysis + [reader (///declaration.lifted_analysis (..reader module aliases source))] (function (_ state) (case (///phase.result' state (..iteration' wrapper archive expander reader source pre_payload)) @@ -231,11 +231,11 @@ (-> .Module Aliases) (|>> (the .#module_aliases) (dictionary.of_list text.hash))) -(def .public (compiler wrapper expander prelude write_directive) - (All (_ anchor expression directive) - (-> ///phase.Wrapper Expander descriptor.Module (-> directive Binary) - (Instancer (///directive.State+ anchor expression directive) .Module))) - (let [execute! (directiveP.phase wrapper expander)] +(def .public (compiler wrapper expander prelude write_declaration) + (All (_ anchor expression declaration) + (-> ///phase.Wrapper Expander descriptor.Module (-> declaration Binary) + (Instancer (///declaration.State+ anchor expression declaration) .Module))) + (let [execute! (declarationP.phase wrapper expander)] (function (_ key parameters input) (let [dependencies (default_dependencies prelude input)] [///.#dependencies dependencies @@ -262,8 +262,8 @@ {.#Right [[module.#id (try.else module.runtime (archive.id module archive)) module.#descriptor descriptor module.#document (document.document key analysis_module)] - (sequence#each (function (_ [artifact_id custom directive]) - [artifact_id custom (write_directive directive)]) + (sequence#each (function (_ [artifact_id custom declaration]) + [artifact_id custom (write_declaration declaration)]) final_buffer) final_registry]}])) @@ -271,21 +271,21 @@ (let [[temporary_buffer temporary_registry] temporary_payload] (in [state {.#Left [///.#dependencies (|> requirements - (the ///directive.#imports) + (the ///declaration.#imports) (list#each product.left)) ///.#process (function (_ state archive) (again (<| (///phase.result' state) (do [! ///phase.monad] [analysis_module (<| (is (Operation .Module)) - ///directive.lifted_analysis + ///declaration.lifted_analysis extension.lifted meta.current_module) - _ (///directive.lifted_generation + _ (///declaration.lifted_generation (///generation.set_buffer temporary_buffer)) - _ (///directive.lifted_generation + _ (///declaration.lifted_generation (///generation.set_registry temporary_registry)) _ (|> requirements - (the ///directive.#referrals) + (the ///declaration.#referrals) (monad.each ! (execute! archive))) temporary_payload (..get_current_payload temporary_payload)] (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))]}])) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 0f893a1dc..492644edc 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -20,7 +20,7 @@ ["[0]" binary (.only Binary) ["_" \\format (.only Format)]] ["[0]" text (.use "[1]#[0]" equivalence) - ["%" \\format (.only format)]] + ["%" \\format]] [collection ["[0]" dictionary (.only Dictionary)] ["[0]" sequence (.only Sequence) (.use "[1]#[0]" mix)] @@ -44,7 +44,7 @@ ["[0]" syntax] ["[1][0]" synthesis] ["[1][0]" generation (.only Buffer)] - ["[1][0]" directive] + ["[1][0]" declaration] ["[1][0]" analysis (.only) [macro (.only Expander)] ["[0]A" module]] @@ -71,16 +71,16 @@ ["[1]" context] ["ioW" archive]]]]]) -(with_expansions [<type_vars> (these anchor expression directive) +(with_expansions [<type_vars> (these anchor expression declaration) <Operation> (these ///generation.Operation <type_vars>)] (type .public (Platform <type_vars>) (Record [#file_system (file.System Async) - #host (///generation.Host expression directive) + #host (///generation.Host expression declaration) #phase (///generation.Phase <type_vars>) #runtime (<Operation> [Registry Output]) #phase_wrapper (-> Archive (<Operation> ///phase.Wrapper)) - #write (-> directive Binary)])) + #write (-> declaration Binary)])) ... TODO: Get rid of this (type (Action a) @@ -92,7 +92,7 @@ (try.with async.monad))) (with_expansions [<Platform> (these (Platform <type_vars>)) - <State+> (these (///directive.State+ <type_vars>)) + <State+> (these (///declaration.State+ <type_vars>)) <Bundle> (these (///generation.Bundle <type_vars>))] (def (format //) @@ -175,10 +175,10 @@ (def (process_runtime archive platform) (All (_ <type_vars>) (-> Archive <Platform> - (///directive.Operation <type_vars> - [Archive (archive.Entry .Module)]))) + (///declaration.Operation <type_vars> + [Archive (archive.Entry .Module)]))) (do ///phase.monad - [[registry payload] (///directive.lifted_generation + [[registry payload] (///declaration.lifted_generation (..compile_runtime! platform)) .let [entry [..runtime_module payload registry]] archive (///phase.lifted (if (archive.reserved? archive descriptor.runtime) @@ -192,7 +192,7 @@ [analysers synthesizers generators - directives] + declarations] analysis_state state) (All (_ <type_vars>) @@ -200,24 +200,24 @@ [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler <type_vars>)) - (Dictionary Text (///directive.Handler <type_vars>))] + (Dictionary Text (///declaration.Handler <type_vars>))] .Lux <State+> (Try <State+>))) (|> (sharing [<type_vars>] (is <State+> state) - (is (///directive.Operation <type_vars> Any) + (is (///declaration.Operation <type_vars> Any) (do [! ///phase.monad] - [_ (///directive.lifted_analysis + [_ (///declaration.lifted_analysis (do ! [_ (///analysis.set_state analysis_state)] (extension.with extender analysers))) - _ (///directive.lifted_synthesis + _ (///declaration.lifted_synthesis (extension.with extender synthesizers)) - _ (///directive.lifted_generation + _ (///declaration.lifted_generation (extension.with extender (as_expected generators))) - _ (extension.with extender (as_expected directives))] + _ (extension.with extender (as_expected declarations))] (in [])))) (///phase.result' state) (at try.monad each product.left))) @@ -227,27 +227,27 @@ (-> Archive <Platform> <State+> (Try [<State+> ///phase.Wrapper]))) (|> archive ((the #phase_wrapper platform)) - ///directive.lifted_generation + ///declaration.lifted_generation (///phase.result' state))) - (def (complete_extensions host_directive_bundle phase_wrapper [analysers synthesizers generators directives]) + (def (complete_extensions host_declaration_bundle phase_wrapper [analysers synthesizers generators declarations]) (All (_ <type_vars>) - (-> (-> ///phase.Wrapper (///directive.Bundle <type_vars>)) + (-> (-> ///phase.Wrapper (///declaration.Bundle <type_vars>)) ///phase.Wrapper [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler <type_vars>)) - (Dictionary Text (///directive.Handler <type_vars>))] + (Dictionary Text (///declaration.Handler <type_vars>))] [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler <type_vars>)) - (Dictionary Text (///directive.Handler <type_vars>))])) + (Dictionary Text (///declaration.Handler <type_vars>))])) [analysers synthesizers generators - (dictionary.composite directives (host_directive_bundle phase_wrapper))]) + (dictionary.composite declarations (host_declaration_bundle phase_wrapper))]) - (def .public (initialize context module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + (def .public (initialize context module expander host_analysis platform generation_bundle host_declaration_bundle program anchorT,expressionT,declarationT extender import compilation_sources compilation_configuration) (All (_ <type_vars>) (-> context.Context @@ -256,8 +256,8 @@ ///analysis.Bundle <Platform> <Bundle> - (-> ///phase.Wrapper (///directive.Bundle <type_vars>)) - (Program expression directive) + (-> ///phase.Wrapper (///declaration.Bundle <type_vars>)) + (Program expression declaration) [Type Type Type] (-> ///phase.Wrapper Extender) Import (List _io.Context) Configuration (Async (Try [<State+> Archive ///phase.Wrapper])))) @@ -275,7 +275,7 @@ [archive analysis_state bundles] (ioW.thaw (list) compilation_configuration (the #host platform) (the #file_system platform) context import compilation_sources) .let [with_missing_extensions (is (All (_ <type_vars>) - (-> <Platform> (Program expression directive) <State+> + (-> <Platform> (Program expression declaration) <State+> (Async (Try [///phase.Wrapper <State+>])))) (function (_ platform program state) (async#in @@ -283,9 +283,9 @@ [[state phase_wrapper] (..phase_wrapper archive platform state)] (|> state (initialize_state (extender phase_wrapper) - (as_expected (..complete_extensions host_directive_bundle phase_wrapper (as_expected bundles))) + (as_expected (..complete_extensions host_declaration_bundle phase_wrapper (as_expected bundles))) analysis_state) - (try#each (|>> (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper)) + (try#each (|>> (//init.with_default_declarations expander host_analysis program anchorT,expressionT,declarationT (extender phase_wrapper)) [phase_wrapper])))))))]] (if (archive.archived? archive descriptor.runtime) (do ! @@ -301,26 +301,26 @@ (in [state archive phase_wrapper]))))) (def compilation_log_separator - (format text.new_line text.tab)) + (%.format text.new_line text.tab)) (def (module_compilation_log module) (All (_ <type_vars>) (-> descriptor.Module <State+> Text)) (|>> (the [extension.#state - ///directive.#generation - ///directive.#state + ///declaration.#generation + ///declaration.#state extension.#state ///generation.#log]) (sequence#mix (function (_ right left) - (format left ..compilation_log_separator right)) + (%.format left ..compilation_log_separator right)) module))) (def with_reset_log (All (_ <type_vars>) (-> <State+> <State+>)) (has [extension.#state - ///directive.#generation - ///directive.#state + ///declaration.#generation + ///declaration.#state extension.#state ///generation.#log] sequence.empty)) @@ -447,10 +447,10 @@ [inherited (with_extensions (the <path> from) (the <path> state))] (in (has <path> inherited state))))] - [with_analysis_extensions [extension.#state ///directive.#analysis ///directive.#state extension.#bundle]] - [with_synthesis_extensions [extension.#state ///directive.#synthesis ///directive.#state extension.#bundle]] - [with_generation_extensions [extension.#state ///directive.#generation ///directive.#state extension.#bundle]] - [with_directive_extensions [extension.#bundle]] + [with_analysis_extensions [extension.#state ///declaration.#analysis ///declaration.#state extension.#bundle]] + [with_synthesis_extensions [extension.#state ///declaration.#synthesis ///declaration.#state extension.#bundle]] + [with_generation_extensions [extension.#state ///declaration.#generation ///declaration.#state extension.#bundle]] + [with_declaration_extensions [extension.#bundle]] ) (def (with_all_extensions from state) @@ -460,7 +460,7 @@ [state (with_analysis_extensions from state) state (with_synthesis_extensions from state) state (with_generation_extensions from state)] - (with_directive_extensions from state))) + (with_declaration_extensions from state))) (type (Context state) [Archive state]) @@ -600,8 +600,8 @@ with_modules (is (All (_ <type_vars>) (-> <State+> <State+>)) (revised [extension.#state - ///directive.#analysis - ///directive.#state + ///declaration.#analysis + ///declaration.#state extension.#state] (is (All (_ a) (-> a a)) (function (_ analysis_state) @@ -620,7 +620,7 @@ (def (set_current_module module state) (All (_ <type_vars>) (-> descriptor.Module <State+> <State+>)) - (|> (///directive.set_current_module module) + (|> (///declaration.set_current_module module) (///phase.result' state) try.trusted product.left)) @@ -685,9 +685,9 @@ (Try [<State+> (Either (///.Compilation <State+> .Module Any) (archive.Entry Any))]))) ((the ///.#process compilation) - ... TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP. + ... TODO: The "///declaration.set_current_module" below shouldn't be necessary. Remove it ASAP. ... TODO: The context shouldn't need to be re-set either. - (|> (///directive.set_current_module module) + (|> (///declaration.set_current_module module) (///phase.result' state) try.trusted product.left) @@ -856,8 +856,8 @@ [context (import! (list) descriptor.runtime /#module) .let [[archive state] context meta_state (the [extension.#state - ///directive.#analysis - ///directive.#state + ///declaration.#analysis + ///declaration.#state extension.#state] state)] [_ /#type /#value] (|> /#definition diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/declaration.lux index 380e48d63..1f2b4505a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/declaration.lux @@ -26,14 +26,14 @@ [#state state #phase phase])) -(type .public (State anchor expression directive) +(type .public (State anchor expression declaration) (Record [#analysis (Component analysis.State+ analysis.Phase) #synthesis (Component synthesis.State+ synthesis.Phase) - #generation (Component (generation.State+ anchor expression directive) - (generation.Phase anchor expression directive))])) + #generation (Component (generation.State+ anchor expression declaration) + (generation.Phase anchor expression declaration))])) (type .public Import (Record @@ -56,8 +56,8 @@ #referrals (list#composite (the #referrals left) (the #referrals right))]) (with_template [<special> <general>] - [(type .public (<special> anchor expression directive) - (<general> (..State anchor expression directive) Code Requirements))] + [(type .public (<special> anchor expression declaration) + (<general> (..State anchor expression declaration) Code Requirements))] [State+ extension.State] [Operation extension.Operation] @@ -68,33 +68,33 @@ (with_template [<name> <component> <phase>] [(def .public <name> - (All (_ anchor expression directive) - (Operation anchor expression directive <phase>)) + (All (_ anchor expression declaration) + (Operation anchor expression declaration <phase>)) (function (_ [bundle state]) {try.#Success [[bundle state] (the [<component> ..#phase] state)]}))] [analysis ..#analysis analysis.Phase] [synthesis ..#synthesis synthesis.Phase] - [generation ..#generation (generation.Phase anchor expression directive)] + [generation ..#generation (generation.Phase anchor expression declaration)] ) (with_template [<name> <component> <operation>] [(def .public <name> - (All (_ anchor expression directive output) + (All (_ anchor expression declaration output) (-> (<operation> output) - (Operation anchor expression directive output))) + (Operation anchor expression declaration output))) (|>> (phase.sub [(the [<component> ..#state]) (has [<component> ..#state])]) extension.lifted))] [lifted_analysis ..#analysis analysis.Operation] [lifted_synthesis ..#synthesis synthesis.Operation] - [lifted_generation ..#generation (generation.Operation anchor expression directive)] + [lifted_generation ..#generation (generation.Operation anchor expression declaration)] ) (def .public (set_current_module module) - (All (_ anchor expression directive) - (-> Module (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> Module (Operation anchor expression declaration Any))) (do phase.monad [_ (..lifted_analysis (analysis.set_current_module module))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index 67bc8b4c1..b8067a964 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -39,8 +39,8 @@ ["[0]" module (.only) ["[0]" descriptor]]]]]]) -(type .public (Buffer directive) - (Sequence [artifact.ID (Maybe Text) directive])) +(type .public (Buffer declaration) + (Sequence [artifact.ID (Maybe Text) declaration])) (exception .public (cannot_interpret [error Text]) (exception.report @@ -55,28 +55,28 @@ [no_buffer_for_saving_code] ) -(type .public (Host expression directive) +(type .public (Host expression declaration) (Interface (is (-> unit.ID [(Maybe unit.ID) expression] (Try Any)) evaluate) - (is (-> directive (Try Any)) + (is (-> declaration (Try Any)) execute) - (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any directive])) + (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any declaration])) define) - (is (-> unit.ID Binary directive) + (is (-> unit.ID Binary declaration) ingest) - (is (-> unit.ID (Maybe Text) directive (Try Any)) + (is (-> unit.ID (Maybe Text) declaration (Try Any)) re_learn) - (is (-> unit.ID (Maybe Text) directive (Try Any)) + (is (-> unit.ID (Maybe Text) declaration (Try Any)) re_load))) -(type .public (State anchor expression directive) +(type .public (State anchor expression declaration) (Record [#module descriptor.Module #anchor (Maybe anchor) - #host (Host expression directive) - #buffer (Maybe (Buffer directive)) + #host (Host expression declaration) + #buffer (Maybe (Buffer declaration)) #registry Registry #registry_shift Nat #counter Nat @@ -85,8 +85,8 @@ #interim_artifacts (List artifact.ID)])) (with_template [<special> <general>] - [(type .public (<special> anchor expression directive) - (<general> (State anchor expression directive) Synthesis expression))] + [(type .public (<special> anchor expression declaration) + (<general> (State anchor expression declaration) Synthesis expression))] [State+ extension.State] [Operation extension.Operation] @@ -97,10 +97,10 @@ ) (def .public (state host module) - (All (_ anchor expression directive) - (-> (Host expression directive) + (All (_ anchor expression declaration) + (-> (Host expression declaration) descriptor.Module - (..State anchor expression directive))) + (..State anchor expression declaration))) [#module module #anchor {.#None} #host host @@ -122,7 +122,7 @@ [(exception .public <exception>) (def .public <with_declaration> - (All (_ anchor expression directive output) <with_type>) + (All (_ anchor expression declaration output) <with_type>) (function (_ body) (function (_ [bundle state]) (case (body [bundle (has <tag> {.#Some <with_value>} state)]) @@ -134,8 +134,8 @@ {try.#Failure error})))) (def .public <get> - (All (_ anchor expression directive) - (Operation anchor expression directive <get_type>)) + (All (_ anchor expression declaration) + (Operation anchor expression declaration <get_type>)) (function (_ (^.let stateE [bundle state])) (case (the <tag> state) {.#Some output} @@ -145,66 +145,66 @@ (exception.except <exception> [])))) (def .public (<set> value) - (All (_ anchor expression directive) - (-> <get_type> (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> <get_type> (Operation anchor expression declaration Any))) (function (_ [bundle state]) {try.#Success [[bundle (has <tag> {.#Some value} state)] []]}))] [#anchor (with_anchor anchor) - (-> anchor (Operation anchor expression directive output) - (Operation anchor expression directive output)) + (-> anchor (Operation anchor expression declaration output) + (Operation anchor expression declaration output)) anchor set_anchor anchor anchor no_anchor] [#buffer with_buffer - (-> (Operation anchor expression directive output) - (Operation anchor expression directive output)) + (-> (Operation anchor expression declaration output) + (Operation anchor expression declaration output)) ..empty_buffer - set_buffer buffer (Buffer directive) no_active_buffer] + set_buffer buffer (Buffer declaration) no_active_buffer] ) (def .public get_registry - (All (_ anchor expression directive) - (Operation anchor expression directive Registry)) + (All (_ anchor expression declaration) + (Operation anchor expression declaration Registry)) (function (_ (^.let stateE [bundle state])) {try.#Success [stateE (the #registry state)]})) (def .public (set_registry value) - (All (_ anchor expression directive) - (-> Registry (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> Registry (Operation anchor expression declaration Any))) (function (_ [bundle state]) {try.#Success [[bundle (has #registry value state)] []]})) (def .public next - (All (_ anchor expression directive) - (Operation anchor expression directive Nat)) + (All (_ anchor expression declaration) + (Operation anchor expression declaration Nat)) (do phase.monad [count (extension.read (the #counter)) _ (extension.update (revised #counter ++))] (in count))) (def .public (symbol prefix) - (All (_ anchor expression directive) - (-> Text (Operation anchor expression directive Text))) + (All (_ anchor expression declaration) + (-> Text (Operation anchor expression declaration Text))) (at phase.monad each (|>> %.nat (format prefix)) ..next)) (def .public (enter_module module) - (All (_ anchor expression directive) - (-> descriptor.Module (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> descriptor.Module (Operation anchor expression declaration Any))) (extension.update (has #module module))) (def .public module - (All (_ anchor expression directive) - (Operation anchor expression directive descriptor.Module)) + (All (_ anchor expression declaration) + (Operation anchor expression declaration descriptor.Module)) (extension.read (the #module))) (def .public (evaluate! label code) - (All (_ anchor expression directive) - (-> unit.ID [(Maybe unit.ID) expression] (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> unit.ID [(Maybe unit.ID) expression] (Operation anchor expression declaration Any))) (function (_ (^.let state+ [bundle state])) (case (at (the #host state) evaluate label code) {try.#Success output} @@ -214,8 +214,8 @@ (exception.except ..cannot_interpret [error])))) (def .public (execute! code) - (All (_ anchor expression directive) - (-> directive (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> declaration (Operation anchor expression declaration Any))) (function (_ (^.let state+ [bundle state])) (case (at (the #host state) execute code) {try.#Success output} @@ -225,8 +225,8 @@ (exception.except ..cannot_interpret error)))) (def .public (define! context custom code) - (All (_ anchor expression directive) - (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Operation anchor expression directive [Text Any directive]))) + (All (_ anchor expression declaration) + (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Operation anchor expression declaration [Text Any declaration]))) (function (_ (^.let stateE [bundle state])) (case (at (the #host state) define context custom code) {try.#Success output} @@ -236,8 +236,8 @@ (exception.except ..cannot_interpret error)))) (def .public (save! artifact_id custom code) - (All (_ anchor expression directive) - (-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> artifact.ID (Maybe Text) declaration (Operation anchor expression declaration Any))) (do [! phase.monad] [?buffer (extension.read (the #buffer))] (case ?buffer @@ -252,8 +252,8 @@ (with_template [<type> <mandatory?> <inputs> <input_types> <name> <artifact>] [(`` (def .public (<name> it (~~ (template.spliced <inputs>)) dependencies) - (All (_ anchor expression directive) - (-> <type> (~~ (template.spliced <input_types>)) (Set unit.ID) (Operation anchor expression directive artifact.ID))) + (All (_ anchor expression declaration) + (-> <type> (~~ (template.spliced <input_types>)) (Set unit.ID) (Operation anchor expression declaration artifact.ID))) (function (_ (^.let stateE [bundle state])) (let [[id registry'] (<artifact> it <mandatory?> dependencies (the #registry state))] {try.#Success [[bundle (has #registry registry' state)] @@ -264,7 +264,7 @@ [Text #0 [] [] learn_analyser registry.analyser] [Text #0 [] [] learn_synthesizer registry.synthesizer] [Text #0 [] [] learn_generator registry.generator] - [Text #0 [] [] learn_directive registry.directive] + [Text #0 [] [] learn_declaration registry.declaration] ) (exception .public (unknown_definition [name Symbol @@ -275,8 +275,8 @@ "Known Definitions" (exception.listing product.left known_definitions))) (def .public (remember archive name) - (All (_ anchor expression directive) - (-> Archive Symbol (Operation anchor expression directive unit.ID))) + (All (_ anchor expression declaration) + (-> Archive Symbol (Operation anchor expression declaration unit.ID))) (function (_ (^.let stateE [bundle state])) (let [[_module _name] name] (do try.monad @@ -294,8 +294,8 @@ {try.#Success [stateE [@module id]]}))))) (def .public (definition archive name) - (All (_ anchor expression directive) - (-> Archive Symbol (Operation anchor expression directive [unit.ID (Maybe category.Definition)]))) + (All (_ anchor expression declaration) + (-> Archive Symbol (Operation anchor expression declaration [unit.ID (Maybe category.Definition)]))) (function (_ (^.let stateE [bundle state])) (let [[_module _name] name] (do try.monad @@ -315,16 +315,16 @@ (exception .public no_context) (def .public (module_id module archive) - (All (_ anchor expression directive) - (-> descriptor.Module Archive (Operation anchor expression directive module.ID))) + (All (_ anchor expression declaration) + (-> descriptor.Module Archive (Operation anchor expression declaration module.ID))) (function (_ (^.let stateE [bundle state])) (do try.monad [@module (archive.id module archive)] (in [stateE @module])))) (def .public (context archive) - (All (_ anchor expression directive) - (-> Archive (Operation anchor expression directive unit.ID))) + (All (_ anchor expression declaration) + (-> Archive (Operation anchor expression declaration unit.ID))) (function (_ (^.let stateE [bundle state])) (case (the #context state) {.#None} @@ -336,10 +336,10 @@ (in [stateE [@module id]]))))) (def .public (with_context @artifact body) - (All (_ anchor expression directive a) + (All (_ anchor expression declaration a) (-> artifact.ID - (Operation anchor expression directive a) - (Operation anchor expression directive a))) + (Operation anchor expression declaration a) + (Operation anchor expression declaration a))) (function (_ [bundle state]) (do try.monad [[[bundle' state'] output] (body [bundle (has #context {.#Some @artifact} state)])] @@ -347,10 +347,10 @@ output])))) (def .public (with_registry_shift shift body) - (All (_ anchor expression directive a) + (All (_ anchor expression declaration a) (-> Nat - (Operation anchor expression directive a) - (Operation anchor expression directive a))) + (Operation anchor expression declaration a) + (Operation anchor expression declaration a))) (function (_ [bundle state]) (do try.monad [[[bundle' state'] output] (body [bundle (has #registry_shift shift state)])] @@ -358,9 +358,9 @@ output])))) (def .public (with_new_context archive dependencies body) - (All (_ anchor expression directive a) - (-> Archive (Set unit.ID) (Operation anchor expression directive a) - (Operation anchor expression directive [unit.ID a]))) + (All (_ anchor expression declaration a) + (-> Archive (Set unit.ID) (Operation anchor expression declaration a) + (Operation anchor expression declaration [unit.ID a]))) (function (_ (^.let stateE [bundle state])) (let [[@artifact registry'] (registry.resource false dependencies (the #registry state)) @artifact (n.+ @artifact (the #registry_shift state))] @@ -375,17 +375,17 @@ output]]))))) (def .public (log! message) - (All (_ anchor expression directive a) - (-> Text (Operation anchor expression directive Any))) + (All (_ anchor expression declaration a) + (-> Text (Operation anchor expression declaration Any))) (function (_ [bundle state]) {try.#Success [[bundle (revised #log (sequence.suffix message) state)] []]})) (def .public (with_interim_artifacts archive body) - (All (_ anchor expression directive a) - (-> Archive (Operation anchor expression directive a) - (Operation anchor expression directive [(List unit.ID) a]))) + (All (_ anchor expression declaration a) + (-> Archive (Operation anchor expression declaration a) + (Operation anchor expression declaration [(List unit.ID) a]))) (do phase.monad [module (extension.read (the #module))] (function (_ state+) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/declaration.lux index cffe0d681..806308519 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/declaration.lux @@ -16,7 +16,7 @@ ["[1][0]" extension] ["[1][0]" analysis] ["/[1]" // - ["/" directive (.only Operation Phase)] + ["/" declaration (.only Operation Phase)] ["[1][0]" analysis (.only) ["[0]" evaluation] ["[1]/[0]" macro (.only Expander)] @@ -28,9 +28,9 @@ [meta [archive (.only Archive)]]]]]) -(exception .public (not_a_directive [code Code]) +(exception .public (not_a_declaration [code Code]) (exception.report - "Directive" (%.code code))) + "Declaration" (%.code code))) (exception .public (invalid_macro_call [code Code]) (exception.report @@ -55,9 +55,9 @@ {try.#Failure error}))) (def (requiring phase archive expansion) - (All (_ anchor expression directive) - (-> (Phase anchor expression directive) Archive (List Code) - (Operation anchor expression directive /.Requirements))) + (All (_ anchor expression declaration) + (-> (Phase anchor expression declaration) Archive (List Code) + (Operation anchor expression declaration /.Requirements))) (function (_ state) (loop (again [state state input expansion @@ -122,4 +122,4 @@ (..requiring again archive expansion))) _ - (//.except ..not_a_directive code))))))) + (//.except ..not_a_declaration code))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 4696b3104..eb523d7e0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Module Primitive char int) + [lux (.except Type Module Primitive char int type) ["[0]" ffi (.only import)] ["[0]" meta] [abstract @@ -70,7 +70,7 @@ ["[1]" abstract]]]] ["/[1]" // ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] ["[1][0]" analysis (.only Analysis Operation Phase Handler Bundle) ["[0]" complex] ["[0]" pattern] @@ -226,7 +226,7 @@ [char (reflection.reflection reflection.char)] ) -(type Member +(.type Member (Record [#class External #member Text])) @@ -235,7 +235,7 @@ (Parser Member) (all <>.and <code>.text <code>.text)) -(type Method_Signature +(.type Method_Signature (Record [#method .Type #deprecated? Bit @@ -1150,7 +1150,7 @@ valueA objectA)))))])) -(type Method_Style +(.type Method_Style (Variant {#Static} {#Abstract} @@ -1357,7 +1357,7 @@ concrete_exceptions generic_exceptions)])))) -(type Evaluation +(.type Evaluation (Variant {#Pass Method_Signature} {#Hint Method_Signature})) @@ -1650,14 +1650,14 @@ ))) ))) -(type .public (Annotation_Parameter a) +(.type .public (Annotation_Parameter a) [Text a]) (def annotation_parameter (Parser (Annotation_Parameter Code)) (<code>.tuple (<>.and <code>.text <code>.any))) -(type .public (Annotation a) +(.type .public (Annotation a) [Text (List (Annotation_Parameter a))]) (def .public annotation @@ -1767,15 +1767,15 @@ [invalid_overriden_methods] ) -(type .public Visibility +(.type .public Visibility (Variant {#Public} {#Private} {#Protected} {#Default})) -(type .public Finality Bit) -(type .public Strictness Bit) +(.type .public Finality Bit) +(.type .public Strictness Bit) (def .public public_tag "public") (def .public private_tag "private") @@ -1803,7 +1803,7 @@ {#Protected} ..protected_tag {#Default} ..default_tag))) -(type Exception +(.type Exception (Type Class)) (def .public parameter_types @@ -1814,7 +1814,7 @@ [[_ parameterT] check.existential] (in [parameterJ parameterT]))))) -(type .public (Abstract_Method a) +(.type .public (Abstract_Method a) [Text Visibility (List (Annotation a)) @@ -1874,7 +1874,7 @@ (/////analysis.tuple (list#each class_analysis exceptions)) )))))) -(type .public (Constructor a) +(.type .public (Constructor a) [Visibility Strictness (List (Annotation a)) @@ -1952,7 +1952,7 @@ (/////analysis.tuple (list bodyA))} )))))) -(type .public (Virtual_Method a) +(.type .public (Virtual_Method a) [Text Visibility Finality @@ -1984,7 +1984,7 @@ (<code>.tuple (<>.some ..class)) <code>.any))) -(type .public (Method_Declaration a) +(.type .public (Method_Declaration a) (Record [#name Text #annotations (List (Annotation a)) @@ -2052,7 +2052,7 @@ (/////analysis.tuple (list bodyA))} )))))) -(type .public (Static_Method a) +(.type .public (Static_Method a) [Text Visibility Strictness @@ -2125,7 +2125,7 @@ (/////analysis.tuple (list bodyA))} )))))) -(type .public (Overriden_Method a) +(.type .public (Overriden_Method a) [(Type Class) Text Bit @@ -2436,21 +2436,21 @@ (list.empty? invalid_overriden_methods))] (in []))) -(type Declaration +(.type Declaration [Text (List (Type Var))]) -(type Constant +(.type Constant [Text (List Annotation) (Type Value) Code]) -(type Variable +(.type Variable [Text (Modifier field.Field) (Modifier field.Field) (List Annotation) (Type Value)]) -(type Field +(.type Field (Variant {#Constant Constant} {#Variable Variable})) -(type (Method_Definition a) +(.type (Method_Definition a) (Variant {#Constructor (..Constructor a)} {#Virtual_Method (..Virtual_Method a)} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux index 39104d42d..9fdfb4d7c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -65,7 +65,7 @@ [language [lux ["[0]" generation] - ["[0]" directive (.only Handler Bundle)] + ["[0]" declaration (.only Handler Bundle)] ["[0]" analysis (.only Analysis) ["[0]A" type] ["[0]A" scope]] @@ -83,13 +83,13 @@ [generation [jvm ["[0]" host]]] - [directive + [declaration ["/" lux]]]]]]]] [type ["[0]" check (.only Check)]]]]) (type Operation - (directive.Operation Anchor (Bytecode Any) Definition)) + (declaration.Operation Anchor (Bytecode Any) Definition)) (def signature (|>> type.signature signature.signature)) (def reflection (|>> type.reflection reflection.reflection)) @@ -461,8 +461,8 @@ self arguments constructor_argumentsS bodyS] method]) (do [! phase.monad] - [generate directive.generation]) - directive.lifted_generation + [generate declaration.generation]) + declaration.lifted_generation (do ! [constructor_argumentsG (monad.each ! (|>> product.right (generate archive)) constructor_argumentsS) @@ -537,8 +537,8 @@ bodyS (case (list.size arguments) 0 (host.without_fake_parameter bodyS) _ bodyS)] - generate directive.generation] - (directive.lifted_generation + generate declaration.generation] + (declaration.lifted_generation (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] @@ -561,8 +561,8 @@ [.let [[method_name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ bodyS] method] - generate directive.generation] - (directive.lifted_generation + generate declaration.generation] + (declaration.lifted_generation (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] @@ -588,8 +588,8 @@ [.let [[method_name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ bodyS] method] - generate directive.generation] - (directive.lifted_generation + generate declaration.generation] + (declaration.lifted_generation (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] @@ -649,7 +649,7 @@ (function (_ methodC) (do phase.monad [methodA (is (Operation Analysis) - (directive.lifted_analysis + (declaration.lifted_analysis (case methodC {#Constructor method} (jvm.analyse_constructor_method analyse archive selfT mapping method) @@ -666,9 +666,9 @@ {#Abstract_Method method} (jvm.analyse_abstract_method analyse archive method)))) methodS (is (Operation Synthesis) - (directive.lifted_synthesis + (declaration.lifted_synthesis (synthesize archive methodA))) - dependencies (directive.lifted_generation + dependencies (declaration.lifted_generation (cache.dependencies archive methodS)) methodS' (|> methodS list @@ -846,7 +846,7 @@ (def (save_class! name bytecode dependencies) (-> Text Binary (Set unit.ID) (Operation Any)) - (directive.lifted_generation + (declaration.lifted_generation (do [! phase.monad] [.let [artifact [name bytecode]] artifact_id (generation.learn_custom name dependencies) @@ -888,9 +888,9 @@ fields methods)) ... Necessary for reflection to work properly during analysis. - _ (directive.lifted_generation + _ (declaration.lifted_generation (generation.execute! mock)) - parameters (directive.lifted_analysis + parameters (declaration.lifted_analysis (typeA.check (jvm.parameter_types parameters))) .let [mapping (list#mix (function (_ [parameterJ parameterT] mapping) (dictionary.has (parser.name parameterJ) parameterT mapping)) @@ -899,9 +899,9 @@ selfT {.#Primitive name (list#each product.right parameters)}] state (extension.lifted phase.state) methods (monad.each ! (..method_definition archive super interfaces [mapping selfT] - [(the [directive.#analysis directive.#phase] state) - (the [directive.#synthesis directive.#phase] state) - (the [directive.#generation directive.#phase] state)]) + [(the [declaration.#analysis declaration.#phase] state) + (the [declaration.#synthesis declaration.#phase] state) + (the [declaration.#generation declaration.#phase] state)]) methods) .let [all_dependencies (cache.all (list#each product.left methods))] bytecode (<| (at ! each (\\format.result class.format)) @@ -918,7 +918,7 @@ (list#each product.right methods) sequence.empty)) _ (..save_class! name bytecode all_dependencies)] - (in directive.no_requirements)))])) + (in declaration.no_requirements)))])) (def (method_declaration (open "/[0]")) (-> (jvm.Method_Declaration Code) (Resource Method)) @@ -941,7 +941,7 @@ (<code>.tuple (<>.some ..annotation)) (<>.some jvm.method_declaration)) (function (_ extension_name phase archive [[name parameters] supers annotations method_declarations]) - (directive.lifted_generation + (declaration.lifted_generation (do [! phase.monad] [bytecode (<| (at ! each (\\format.result class.format)) phase.lifted @@ -964,7 +964,7 @@ _ (generation.execute! artifact) _ (generation.save! artifact_id {.#Some name} artifact) _ (generation.log! (format "JVM Interface " (%.text name)))] - (in directive.no_requirements))))])) + (in declaration.no_requirements))))])) (import java/lang/ClassLoader "[1]::[0]") diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux index 0d02b109f..d2d4592e6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux @@ -43,7 +43,7 @@ ["[0]" scope]] ["[1][0]" synthesis (.only Synthesis)] ["[1][0]" generation] - ["[1][0]" directive (.only Import Requirements Phase Operation Handler Bundle)] + ["[1][0]" declaration (.only Import Requirements Phase Operation Handler Bundle)] ["[1][0]" program (.only Program)] [/// ["[0]" phase] @@ -57,14 +57,14 @@ ["[1]/[0]" artifact]]]]]]]]) (def .public (custom [syntax handler]) - (All (_ anchor expression directive s) + (All (_ anchor expression declaration s) (-> [(Parser s) (-> Text - (Phase anchor expression directive) + (Phase anchor expression declaration) Archive s - (Operation anchor expression directive Requirements))] - (Handler anchor expression directive))) + (Operation anchor expression declaration Requirements))] + (Handler anchor expression declaration))) (function (_ extension_name phase archive inputs) (case (<code>.result syntax inputs) {try.#Success inputs} @@ -80,13 +80,13 @@ ... TODO: Inline "evaluate!'" into "evaluate!" ASAP (def (evaluate!' archive generate code//type codeS) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Archive - (/////generation.Phase anchor expression directive) + (/////generation.Phase anchor expression declaration) Type Synthesis - (Operation anchor expression directive [Type expression Any]))) - (/////directive.lifted_generation + (Operation anchor expression declaration [Type expression Any]))) + (/////declaration.lifted_generation (do phase.monad [module /////generation.module id /////generation.next @@ -96,32 +96,32 @@ (in [code//type codeG codeV])))) (def .public (evaluate! archive type codeC) - (All (_ anchor expression directive) - (-> Archive Type Code (Operation anchor expression directive [Type expression Any]))) + (All (_ anchor expression declaration) + (-> Archive Type Code (Operation anchor expression declaration [Type expression Any]))) (do phase.monad [state (///.lifted phase.state) - .let [analyse (the [/////directive.#analysis /////directive.#phase] state) - synthesize (the [/////directive.#synthesis /////directive.#phase] state) - generate (the [/////directive.#generation /////directive.#phase] state)] - [_ codeA] (<| /////directive.lifted_analysis + .let [analyse (the [/////declaration.#analysis /////declaration.#phase] state) + synthesize (the [/////declaration.#synthesis /////declaration.#phase] state) + generate (the [/////declaration.#generation /////declaration.#phase] state)] + [_ codeA] (<| /////declaration.lifted_analysis scope.with typeA.fresh (typeA.expecting type) (analyse archive codeC)) - codeS (/////directive.lifted_synthesis + codeS (/////declaration.lifted_synthesis (synthesize archive codeA))] (evaluate!' archive generate type codeS))) ... TODO: Inline "definition'" into "definition" ASAP (def (definition' archive generate [module name] code//type codeS) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Archive - (/////generation.Phase anchor expression directive) + (/////generation.Phase anchor expression declaration) Symbol Type Synthesis - (Operation anchor expression directive [Type expression Any]))) - (/////directive.lifted_generation + (Operation anchor expression declaration [Type expression Any]))) + (/////declaration.lifted_generation (do phase.monad [dependencies (cache/artifact.dependencies archive codeS) [interim_artifacts codeG] (/////generation.with_interim_artifacts archive @@ -136,20 +136,20 @@ {.#None})] @module (phase.lifted (archive.id module archive)) @self (/////generation.learn [name @abstraction] false (list#mix set.has dependencies interim_artifacts)) - [target_name value directive] (/////generation.define! [@module @self] {.#None} [(maybe#each product.right @abstraction) codeG]) - _ (/////generation.save! @self {.#None} directive)] + [target_name value declaration] (/////generation.define! [@module @self] {.#None} [(maybe#each product.right @abstraction) codeG]) + _ (/////generation.save! @self {.#None} declaration)] (in [code//type codeG value])))) (def (definition archive name expected codeC) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Archive Symbol (Maybe Type) Code - (Operation anchor expression directive [Type expression Any]))) + (Operation anchor expression declaration [Type expression Any]))) (do [! phase.monad] [state (///.lifted phase.state) - .let [analyse (the [/////directive.#analysis /////directive.#phase] state) - synthesize (the [/////directive.#synthesis /////directive.#phase] state) - generate (the [/////directive.#generation /////directive.#phase] state)] - [_ code//type codeA] (/////directive.lifted_analysis + .let [analyse (the [/////declaration.#analysis /////declaration.#phase] state) + synthesize (the [/////declaration.#synthesis /////declaration.#phase] state) + generate (the [/////declaration.#generation /////declaration.#phase] state)] + [_ code//type codeA] (/////declaration.lifted_analysis (scope.with (typeA.fresh (case expected @@ -165,71 +165,71 @@ [codeA (<| (typeA.expecting expected) (analyse archive codeC))] (in [expected codeA])))))) - codeS (/////directive.lifted_synthesis + codeS (/////declaration.lifted_synthesis (synthesize archive codeA))] (definition' archive generate name code//type codeS))) (with_template [<full> <partial> <learn>] [... TODO: Inline "<partial>" into "<full>" ASAP (def (<partial> archive generate extension codeT codeS) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Archive - (/////generation.Phase anchor expression directive) + (/////generation.Phase anchor expression declaration) Text Type Synthesis - (Operation anchor expression directive [expression Any]))) + (Operation anchor expression declaration [expression Any]))) (do phase.monad - [current_module (/////directive.lifted_analysis + [current_module (/////declaration.lifted_analysis (///.lifted meta.current_module_name))] - (/////directive.lifted_generation + (/////declaration.lifted_generation (do phase.monad [dependencies (cache/artifact.dependencies archive codeS) [interim_artifacts codeG] (/////generation.with_interim_artifacts archive (generate archive codeS)) @module (phase.lifted (archive.id current_module archive)) @self (<learn> extension (list#mix set.has dependencies interim_artifacts)) - [target_name value directive] (/////generation.define! [@module @self] {.#None} [{.#None} codeG]) - _ (/////generation.save! @self {.#None} directive)] + [target_name value declaration] (/////generation.define! [@module @self] {.#None} [{.#None} codeG]) + _ (/////generation.save! @self {.#None} declaration)] (in [codeG value]))))) (def .public (<full> archive extension codeT codeC) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Archive Text Type Code - (Operation anchor expression directive [expression Any]))) + (Operation anchor expression declaration [expression Any]))) (do phase.monad [state (///.lifted phase.state) - .let [analyse (the [/////directive.#analysis /////directive.#phase] state) - synthesize (the [/////directive.#synthesis /////directive.#phase] state) - generate (the [/////directive.#generation /////directive.#phase] state)] - [_ codeA] (<| /////directive.lifted_analysis + .let [analyse (the [/////declaration.#analysis /////declaration.#phase] state) + synthesize (the [/////declaration.#synthesis /////declaration.#phase] state) + generate (the [/////declaration.#generation /////declaration.#phase] state)] + [_ codeA] (<| /////declaration.lifted_analysis scope.with typeA.fresh (typeA.expecting codeT) (analyse archive codeC)) - codeS (/////directive.lifted_synthesis + codeS (/////declaration.lifted_synthesis (synthesize archive codeA))] (<partial> archive generate extension codeT codeS)))] [analyser analyser' /////generation.learn_analyser] [synthesizer synthesizer' /////generation.learn_synthesizer] [generator generator' /////generation.learn_generator] - [directive directive' /////generation.learn_directive] + [declaration declaration' /////generation.learn_declaration] ) ... TODO: Get rid of this function ASAP. (def (refresh expander host_analysis) - (All (_ anchor expression directive) - (-> Expander /////analysis.Bundle (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> Expander /////analysis.Bundle (Operation anchor expression declaration Any))) (do phase.monad [[bundle state] phase.state .let [eval (/////analysis/evaluation.evaluator expander - (the [/////directive.#synthesis /////directive.#state] state) - (the [/////directive.#generation /////directive.#state] state) - (the [/////directive.#generation /////directive.#phase] state)) - previous_analysis_extensions (the [/////directive.#analysis /////directive.#state ///.#bundle] state)]] + (the [/////declaration.#synthesis /////declaration.#state] state) + (the [/////declaration.#generation /////declaration.#state] state) + (the [/////declaration.#generation /////declaration.#phase] state)) + previous_analysis_extensions (the [/////declaration.#analysis /////declaration.#state ///.#bundle] state)]] (phase.with [bundle - (revised [/////directive.#analysis /////directive.#state] + (revised [/////declaration.#analysis /////declaration.#state] (is (-> /////analysis.State+ /////analysis.State+) (|>> product.right [(|> previous_analysis_extensions @@ -237,9 +237,9 @@ state)]))) (def (announce_definition! short type) - (All (_ anchor expression directive) - (-> Text Type (Operation anchor expression directive Any))) - (/////directive.lifted_generation + (All (_ anchor expression declaration) + (-> Text Type (Operation anchor expression declaration Any))) + (/////declaration.lifted_generation (/////generation.log! (format short " : " (%.type type))))) (def (lux::def expander host_analysis) @@ -248,24 +248,24 @@ (case inputsC+ (pattern (list [_ {.#Symbol ["" short_name]}] valueC exported?C)) (do phase.monad - [current_module (/////directive.lifted_analysis + [current_module (/////declaration.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [type valueT value] (..definition archive full_name {.#None} valueC) [_ _ exported?] (evaluate! archive Bit exported?C) - _ (/////directive.lifted_analysis + _ (/////declaration.lifted_analysis (moduleA.define short_name {.#Definition [(as Bit exported?) type value]})) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] - (in /////directive.no_requirements)) + (in /////declaration.no_requirements)) _ (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) (def (announce_labels! labels owner) - (All (_ anchor expression directive) - (-> (List Text) Type (Operation anchor expression directive (List Any)))) - (/////directive.lifted_generation + (All (_ anchor expression declaration) + (-> (List Text) Type (Operation anchor expression declaration (List Any)))) + (/////declaration.lifted_generation (monad.each phase.monad (function (_ tag) (/////generation.log! (format tag " : Tag of " (%.type owner)))) @@ -280,13 +280,13 @@ <code>.any) (function (_ extension_name phase archive [short_name valueC labels exported?C]) (do phase.monad - [current_module (/////directive.lifted_analysis + [current_module (/////declaration.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [_ _ exported?] (evaluate! archive Bit exported?C) .let [exported? (as Bit exported?)] [type valueT value] (..definition archive full_name {.#Some .Type} valueC) - labels (/////directive.lifted_analysis + labels (/////declaration.lifted_analysis (do phase.monad [.let [[record? labels] (case labels {.#Left tags} @@ -307,7 +307,7 @@ _ (..refresh expander host_analysis) _ (..announce_definition! short_name type) _ (..announce_labels! labels (as Type value))] - (in /////directive.no_requirements)))])) + (in /////declaration.no_requirements)))])) (def imports (Parser (List Import)) @@ -321,7 +321,7 @@ [..imports (function (_ extension_name phase archive imports) (do [! phase.monad] - [_ (/////directive.lifted_analysis + [_ (/////declaration.lifted_analysis (monad.each ! (function (_ [module alias]) (do ! [_ (moduleA.import module)] @@ -329,8 +329,8 @@ "" (in []) _ (moduleA.alias alias module)))) imports))] - (in [/////directive.#imports imports - /////directive.#referrals (list)])))])) + (in [/////declaration.#imports imports + /////declaration.#referrals (list)])))])) (exception .public (cannot_alias_an_alias [local Alias foreign Alias @@ -370,10 +370,10 @@ (function (_ extension_name phase archive [alias def_name]) (do phase.monad [_ (///.lifted - (phase.sub [(the [/////directive.#analysis /////directive.#state]) - (has [/////directive.#analysis /////directive.#state])] + (phase.sub [(the [/////declaration.#analysis /////declaration.#state]) + (has [/////declaration.#analysis /////declaration.#state])] (define_alias alias def_name)))] - (in /////directive.no_requirements)))])) + (in /////declaration.no_requirements)))])) ... TODO: Stop requiring these types and the "swapped" function below to make types line-up. (with_template [<name> <anonymous>] @@ -420,15 +420,15 @@ {.#Named name (again anonymous)})))) (with_template [<description> <mame> <def_type> <type> <scope> <definer>] - [(def (<mame> [anchorT expressionT directiveT] extender) - (All (_ anchor expression directive) + [(def (<mame> [anchorT expressionT declarationT] extender) + (All (_ anchor expression declaration) (-> [Type Type Type] Extender - (Handler anchor expression directive))) + (Handler anchor expression declaration))) (function (handler extension_name phase archive inputsC+) (case inputsC+ (pattern (list nameC valueC)) (do phase.monad - [target_platform (/////directive.lifted_analysis + [target_platform (/////declaration.lifted_analysis (///.lifted meta.target)) [_ _ name] (evaluate! archive Text nameC) [_ handlerV] (<definer> archive (as Text name) @@ -446,14 +446,14 @@ valueC) _ (<| <scope> (///.install extender (as Text name)) - (sharing [anchor expression directive] - (is (Handler anchor expression directive) + (sharing [anchor expression declaration] + (is (Handler anchor expression declaration) handler) (is <type> (as_expected handlerV)))) - _ (/////directive.lifted_generation + _ (/////declaration.lifted_generation (/////generation.log! (format <description> " " (%.text (as Text name)))))] - (in /////directive.no_requirements)) + (in /////declaration.no_requirements)) _ (phase.except ///.invalid_syntax [extension_name %.code inputsC+]))))] @@ -461,52 +461,52 @@ ["Analysis" defanalysis /////analysis.Handler /////analysis.Handler - /////directive.lifted_analysis + /////declaration.lifted_analysis ..analyser] ["Synthesis" defsynthesis /////synthesis.Handler /////synthesis.Handler - /////directive.lifted_synthesis + /////declaration.lifted_synthesis ..synthesizer] ["Generation" defgeneration - (/////generation.Handler anchorT expressionT directiveT) (/////generation.Handler anchor expression directive) - /////directive.lifted_generation + (/////generation.Handler anchorT expressionT declarationT) (/////generation.Handler anchor expression declaration) + /////declaration.lifted_generation ..generator] - ["Directive" - defdirective - (/////directive.Handler anchorT expressionT directiveT) (/////directive.Handler anchor expression directive) + ["Declaration" + defdeclaration + (/////declaration.Handler anchorT expressionT declarationT) (/////declaration.Handler anchor expression declaration) (<|) - ..directive] + ..declaration] ) ... TODO; Both "prepare-program" and "define-program" exist only ... because the old compiler couldn't handle a fully-inlined definition ... for "defprogram". Inline them ASAP. (def (prepare_program archive analyse synthesize programC) - (All (_ anchor expression directive output) + (All (_ anchor expression declaration output) (-> Archive /////analysis.Phase /////synthesis.Phase Code - (Operation anchor expression directive Synthesis))) + (Operation anchor expression declaration Synthesis))) (do phase.monad - [[_ programA] (<| /////directive.lifted_analysis + [[_ programA] (<| /////declaration.lifted_analysis scope.with typeA.fresh (typeA.expecting (type_literal (-> (List Text) (IO Any)))) (analyse archive programC))] - (/////directive.lifted_synthesis + (/////declaration.lifted_synthesis (synthesize archive programA)))) (def (define_program archive @module generate program programS) - (All (_ anchor expression directive output) + (All (_ anchor expression declaration output) (-> Archive module.ID - (/////generation.Phase anchor expression directive) - (Program expression directive) + (/////generation.Phase anchor expression declaration) + (Program expression declaration) Synthesis - (/////generation.Operation anchor expression directive Any))) + (/////generation.Operation anchor expression declaration Any))) (do phase.monad [dependencies (cache/artifact.dependencies archive programS) [interim_artifacts programG] (/////generation.with_interim_artifacts archive @@ -515,56 +515,56 @@ (/////generation.save! @self {.#None} (program [@module @self] programG)))) (def (defprogram program) - (All (_ anchor expression directive) - (-> (Program expression directive) (Handler anchor expression directive))) + (All (_ anchor expression declaration) + (-> (Program expression declaration) (Handler anchor expression declaration))) (function (handler extension_name phase archive inputsC+) (case inputsC+ (pattern (list programC)) (do phase.monad [state (///.lifted phase.state) - .let [analyse (the [/////directive.#analysis /////directive.#phase] state) - synthesize (the [/////directive.#synthesis /////directive.#phase] state) - generate (the [/////directive.#generation /////directive.#phase] state)] + .let [analyse (the [/////declaration.#analysis /////declaration.#phase] state) + synthesize (the [/////declaration.#synthesis /////declaration.#phase] state) + generate (the [/////declaration.#generation /////declaration.#phase] state)] programS (prepare_program archive analyse synthesize programC) - current_module (/////directive.lifted_analysis + current_module (/////declaration.lifted_analysis (///.lifted meta.current_module_name)) @module (phase.lifted (archive.id current_module archive)) - _ (/////directive.lifted_generation + _ (/////declaration.lifted_generation (define_program archive @module generate program programS))] - (in /////directive.no_requirements)) + (in /////declaration.no_requirements)) _ (phase.except ///.invalid_syntax [extension_name %.code inputsC+])))) -(def (bundle::def expander host_analysis program anchorT,expressionT,directiveT extender) - (All (_ anchor expression directive) +(def (bundle::def expander host_analysis program anchorT,expressionT,declarationT extender) + (All (_ anchor expression declaration) (-> Expander /////analysis.Bundle - (Program expression directive) + (Program expression declaration) [Type Type Type] Extender - (Bundle anchor expression directive))) + (Bundle anchor expression declaration))) (<| (///bundle.prefix "def") (|> ///bundle.empty (dictionary.has "module" defmodule) (dictionary.has "alias" defalias) (dictionary.has "type tagged" (deftype_tagged expander host_analysis)) - (dictionary.has "analysis" (defanalysis anchorT,expressionT,directiveT extender)) - (dictionary.has "synthesis" (defsynthesis anchorT,expressionT,directiveT extender)) - (dictionary.has "generation" (defgeneration anchorT,expressionT,directiveT extender)) - (dictionary.has "directive" (defdirective anchorT,expressionT,directiveT extender)) + (dictionary.has "analysis" (defanalysis anchorT,expressionT,declarationT extender)) + (dictionary.has "synthesis" (defsynthesis anchorT,expressionT,declarationT extender)) + (dictionary.has "generation" (defgeneration anchorT,expressionT,declarationT extender)) + (dictionary.has "declaration" (defdeclaration anchorT,expressionT,declarationT extender)) (dictionary.has "program" (defprogram program)) ))) -(def .public (bundle expander host_analysis program anchorT,expressionT,directiveT extender) - (All (_ anchor expression directive) +(def .public (bundle expander host_analysis program anchorT,expressionT,declarationT extender) + (All (_ anchor expression declaration) (-> Expander /////analysis.Bundle - (Program expression directive) + (Program expression declaration) [Type Type Type] Extender - (Bundle anchor expression directive))) + (Bundle anchor expression declaration))) (<| (///bundle.prefix "lux") (|> ///bundle.empty (dictionary.has "def" (lux::def expander host_analysis)) - (dictionary.composite (..bundle::def expander host_analysis program anchorT,expressionT,directiveT extender))))) + (dictionary.composite (..bundle::def expander host_analysis program anchorT,expressionT,declarationT extender))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index d908ed1a3..073eac767 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -89,13 +89,13 @@ (set.of_list _.hash) set.list) @expression (_.constant (reference.artifact [context_module context_artifact])) - directive (_.define_function @expression (list.partial (_.parameter @input) (list#each _.reference foreigns)) - (list#mix (function (_ [test then] else) - (_.if test (_.return then) else)) - (_.return elseG) - conditionalsG))] - _ (generation.execute! directive) - _ (generation.save! context_artifact directive)] + declaration (_.define_function @expression (list.partial (_.parameter @input) (list#each _.reference foreigns)) + (list#mix (function (_ [test then] else) + (_.if test (_.return then) else)) + (_.return elseG) + conditionalsG))] + _ (generation.execute! declaration) + _ (generation.save! context_artifact declaration)] (in (_.apply (list.partial inputG foreigns) @expression))))])) (def lux_procs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux index 75cb5a86e..501587da2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux @@ -31,12 +31,12 @@ (def arity (syntax (_ [arity <code>.nat]) - (with_symbols [g!_ g!extension g!name g!phase g!archive g!inputs g!anchor g!expression g!directive] + (with_symbols [g!_ g!extension g!name g!phase g!archive g!inputs g!anchor g!expression g!declaration] (do [! meta.monad] [g!input+ (monad.all ! (list.repeated arity (macro.symbol "input")))] - (in (list (` (is (All ((~ g!_) (~ g!anchor) (~ g!expression) (~ g!directive)) + (in (list (` (is (All ((~ g!_) (~ g!anchor) (~ g!expression) (~ g!declaration)) (-> ((Arity (~ (code.nat arity))) (~ g!expression)) - (generation.Handler (~ g!anchor) (~ g!expression) (~ g!directive)))) + (generation.Handler (~ g!anchor) (~ g!expression) (~ g!declaration)))) (function ((~ g!_) (~ g!extension)) (function ((~ g!_) (~ g!name) (~ g!phase) (~ g!archive) (~ g!inputs)) (case (~ g!inputs) @@ -68,8 +68,8 @@ (-> (List of) of)) (def .public (variadic extension) - (All (_ anchor expression directive) - (-> (Variadic expression) (generation.Handler anchor expression directive))) + (All (_ anchor expression declaration) + (-> (Variadic expression) (generation.Handler anchor expression declaration))) (function (_ extension_name) (function (_ phase archive inputsS) (let [! ///.monad] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index 81c42a003..86965220b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type Label) + [lux (.except Type Label type) [data [collection ["[0]" list]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index d8ba5543d..d60aad8a3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type) + [lux (.except Type type) [abstract ["[0]" monad]] [control diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index f592a3aba..faff66f47 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type) + [lux (.except Type type) [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index 9e33db858..c8d769e87 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -183,7 +183,7 @@ (def (re_learn context custom [_ bytecode]) (io.run! (loader.store (maybe.else (//runtime.class_name context) custom) bytecode library))) - (def (re_load context custom [directive_name bytecode]) + (def (re_load context custom [declaration_name bytecode]) (io.run! (do (try.with io.monad) [.let [class_name (maybe.else (//runtime.class_name context) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 53ab302e9..5c44eb15b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -91,28 +91,28 @@ locals (|> initsO+ list.enumeration (list#each (|>> product.left (n.+ start) //case.register))) - [directive instantiation] (is [Statement Expression] - (case (|> (synthesis.path/then bodyS) - //case.dependencies - (set.of_list _.hash) - (set.difference (set.of_list _.hash locals)) - set.list) - {.#End} - [(_.function @loop locals - scope!) - @loop] + [declaration instantiation] (is [Statement Expression] + (case (|> (synthesis.path/then bodyS) + //case.dependencies + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) + set.list) + {.#End} + [(_.function @loop locals + scope!) + @loop] - foreigns - (let [@context (_.var (format (_.code @loop) "_context"))] - [(_.function @context foreigns - (all _.then - (<| (_.local_function @loop locals) - scope!) - (_.return @loop) - )) - (_.apply foreigns @context)])))] - _ (/////generation.execute! directive) - _ (/////generation.save! artifact_id {.#None} directive)] + foreigns + (let [@context (_.var (format (_.code @loop) "_context"))] + [(_.function @context foreigns + (all _.then + (<| (_.local_function @loop locals) + scope!) + (_.return @loop) + )) + (_.apply foreigns @context)])))] + _ (/////generation.execute! declaration) + _ (/////generation.save! artifact_id {.#None} declaration)] (in (_.apply initsO+ instantiation))))) (def .public (again! statement expression archive argsS+) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 8fdaeabc9..2b015ee7f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -290,7 +290,7 @@ .let [@case (_.constant (///reference.artifact [case_module case_artifact])) @dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS) pathP)) - directive (_.define_function @case (list#each _.parameter @dependencies+) case!)] - _ (/////generation.execute! directive) - _ (/////generation.save! case_artifact directive)] + declaration (_.define_function @case (list#each _.parameter @dependencies+) case!)] + _ (/////generation.execute! declaration) + _ (/////generation.save! case_artifact declaration)] (in (_.apply @dependencies+ @case)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 4a80287a7..009dd0271 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -88,21 +88,21 @@ (|>> synthesis.path/then //case.dependencies (set.of_list _.hash))) - [directive instantiation] (is [Statement Expression] - (case (|> (list#each referenced_variables initsS+) - (list#mix set.union (referenced_variables bodyS)) - (set.difference loop_variables) - set.list) - {.#End} - [(_.define_function @loop (list) scope!) - @loop] + [declaration instantiation] (is [Statement Expression] + (case (|> (list#each referenced_variables initsS+) + (list#mix set.union (referenced_variables bodyS)) + (set.difference loop_variables) + set.list) + {.#End} + [(_.define_function @loop (list) scope!) + @loop] - foreigns - [(<| (_.define_function @loop (list#each _.parameter foreigns)) - (_.return (_.closure (list#each _.parameter foreigns) (list) scope!))) - (_.apply foreigns @loop)]))] - _ (/////generation.execute! directive) - _ (/////generation.save! loop_artifact directive)] + foreigns + [(<| (_.define_function @loop (list#each _.parameter foreigns)) + (_.return (_.closure (list#each _.parameter foreigns) (list) scope!))) + (_.apply foreigns @loop)]))] + _ (/////generation.execute! declaration) + _ (/////generation.save! loop_artifact declaration)] (in (_.apply (list) instantiation))))) ... TODO: Stop using a constant hard-coded variable. Generate a new one each time. diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 9b7ad5575..b79dc468b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -354,8 +354,8 @@ .let [@case (_.var (///reference.artifact [case_module case_artifact])) @dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS) pathP)) - directive (_.def @case @dependencies+ - pattern_matching!)] - _ (/////generation.execute! directive) - _ (/////generation.save! case_artifact {.#None} directive)] + declaration (_.def @case @dependencies+ + pattern_matching!)] + _ (/////generation.execute! declaration) + _ (/////generation.save! case_artifact {.#None} declaration)] (in (_.apply @dependencies+ @case)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index efbc2ca8c..e7ee5d68f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -56,14 +56,14 @@ _ (do [! ///////phase.monad] - [.let [directive (_.def @function - (|> (list.enumeration inits) - (list#each (|>> product.left ..capture))) - (all _.then - function_definition - (_.return @function)))] - _ (/////generation.execute! directive) - _ (/////generation.save! function_id {.#None} directive)] + [.let [declaration (_.def @function + (|> (list.enumeration inits) + (list#each (|>> product.left ..capture))) + (all _.then + function_definition + (_.return @function)))] + _ (/////generation.execute! declaration) + _ (/////generation.save! function_id {.#None} declaration)] (in (_.apply inits @function))))) (def input @@ -92,25 +92,25 @@ (list.indices arity))]] (with_closure function_artifact @self environment (_.def @self (list (_.poly @curried)) - (all _.then - (_.set (list @num_args) (_.len/1 @curried)) - (<| (_.if (|> @num_args (_.= arityO)) - (<| (_.then initialize!) - //loop.set_scope - body!)) - (_.if (|> @num_args (_.> arityO)) - (let [arity_inputs (_.slice (_.int +0) arityO @curried) - extra_inputs (_.slice arityO @num_args @curried)] - (_.return (|> @self - (apply_poly arity_inputs) - (apply_poly extra_inputs))))) - ... (|> @num_args (_.< arityO)) - (let [@next (_.var "next") - @missing (_.var "missing")] - (all _.then - (_.def @next (list (_.poly @missing)) - (_.return (|> @self (apply_poly (|> @curried (_.+ @missing)))))) - (_.return @next) - ))) - ))) + (all _.then + (_.set (list @num_args) (_.len/1 @curried)) + (<| (_.if (|> @num_args (_.= arityO)) + (<| (_.then initialize!) + //loop.set_scope + body!)) + (_.if (|> @num_args (_.> arityO)) + (let [arity_inputs (_.slice (_.int +0) arityO @curried) + extra_inputs (_.slice arityO @num_args @curried)] + (_.return (|> @self + (apply_poly arity_inputs) + (apply_poly extra_inputs))))) + ... (|> @num_args (_.< arityO)) + (let [@next (_.var "next") + @missing (_.var "missing")] + (all _.then + (_.def @next (list (_.poly @missing)) + (_.return (|> @self (apply_poly (|> @curried (_.+ @missing)))))) + (_.return @next) + ))) + ))) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 6ef7dd75d..6ac83864b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -89,25 +89,25 @@ actual_loop (<| (_.def @loop locals) ..set_scope body!) - [directive instantiation] (is [(Statement Any) (Expression Any)] - (case (|> (synthesis.path/then bodyS) - //case.dependencies - (set.of_list _.hash) - (set.difference (set.of_list _.hash locals)) - set.list) - {.#End} - [actual_loop - @loop] + [declaration instantiation] (is [(Statement Any) (Expression Any)] + (case (|> (synthesis.path/then bodyS) + //case.dependencies + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) + set.list) + {.#End} + [actual_loop + @loop] - foreigns - [(_.def @loop foreigns - (all _.then - actual_loop - (_.return @loop) - )) - (_.apply foreigns @loop)]))] - _ (/////generation.execute! directive) - _ (/////generation.save! loop_artifact {.#None} directive)] + foreigns + [(_.def @loop foreigns + (all _.then + actual_loop + (_.return @loop) + )) + (_.apply foreigns @loop)]))] + _ (/////generation.execute! declaration) + _ (/////generation.save! loop_artifact {.#None} declaration)] (in (_.apply initsO+ instantiation))))) (def .public (again! statement expression archive argsS+) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux index 2ef7aa07e..97dbdfe82 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -61,9 +61,9 @@ variable'))) (def .public (constant system archive name) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> (System expression) Archive Symbol - (////generation.Operation anchor expression directive expression))) + (////generation.Operation anchor expression declaration expression))) (phase#each (|>> ..artifact (at system constant')) (////generation.remember archive name))) @@ -89,8 +89,8 @@ (..foreign system register))) (def .public (reference system archive reference) - (All (_ anchor expression directive) - (-> (System expression) Archive Reference (////generation.Operation anchor expression directive expression))) + (All (_ anchor expression declaration) + (-> (System expression) Archive Reference (////generation.Operation anchor expression declaration expression))) (case reference {reference.#Constant value} (..constant system archive value) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux index 162f4c147..9b9c15e3f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -21,8 +21,8 @@ [module ["[0]" descriptor]]]]]) -(type .public (Program expression directive) - (-> unit.ID expression directive)) +(type .public (Program expression declaration) + (-> unit.ID expression declaration)) (def .public name Text diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux index a8317290c..665894617 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux @@ -37,7 +37,7 @@ {#Analyser Text} {#Synthesizer Text} {#Generator Text} - {#Directive Text} + {#Declaration Text} {#Custom Text})) (def .public equivalence @@ -57,7 +57,7 @@ ([#Analyser] [#Synthesizer] [#Generator] - [#Directive] + [#Declaration] [#Custom]) _ diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index f93624fbc..ec61e4b79 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -90,7 +90,7 @@ [//category.#Analyser analyser analysers Text |> {.#None}] [//category.#Synthesizer synthesizer synthesizers Text |> {.#None}] [//category.#Generator generator generators Text |> {.#None}] - [//category.#Directive directive directives Text |> {.#None}] + [//category.#Declaration declaration declarations Text |> {.#None}] [//category.#Custom custom customs Text |> {.#None}] ) @@ -127,7 +127,7 @@ [2 //category.#Analyser binary.text] [3 //category.#Synthesizer binary.text] [4 //category.#Generator binary.text] - [5 //category.#Directive binary.text] + [5 //category.#Declaration binary.text] [6 //category.#Custom binary.text])))) mandatory? binary.bit dependency (is (Format unit.ID) @@ -172,7 +172,7 @@ [2 //category.#Analyser <binary>.text] [3 //category.#Synthesizer <binary>.text] [4 //category.#Generator <binary>.text] - [5 //category.#Directive <binary>.text] + [5 //category.#Declaration <binary>.text] [6 //category.#Custom <binary>.text]) _ (<>.failure (exception.error ..invalid_category [tag]))))) @@ -195,7 +195,7 @@ [//category.#Analyser ..analyser] [//category.#Synthesizer ..synthesizer] [//category.#Generator ..generator] - [//category.#Directive ..directive] + [//category.#Declaration ..declaration] [//category.#Custom ..custom]) ))) ..empty))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux index 4a1572890..11fa0a54f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux @@ -163,8 +163,8 @@ list#conjoint))) (def .public (dependencies archive value) - (All (_ anchor expression directive) - (-> Archive Synthesis (Operation anchor expression directive (Set unit.ID)))) + (All (_ anchor expression declaration) + (-> Archive Synthesis (Operation anchor expression declaration (Set unit.ID)))) (let [! phase.monad] (|> value ..references @@ -174,8 +174,8 @@ (at ! each (set.of_list unit.hash))))) (def .public (path_dependencies archive value) - (All (_ anchor expression directive) - (-> Archive Path (Operation anchor expression directive (Set unit.ID)))) + (All (_ anchor expression declaration) + (-> Archive Path (Operation anchor expression declaration (Set unit.ID)))) (let [! phase.monad] (|> value (..path_references ..references) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index 2c7b14da6..3a89e09eb 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -53,7 +53,7 @@ ["[0]" analysis] ["[0]" synthesis] ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] ["[1]/[0]" program]]]]]]) (def (module_parser key parser) @@ -93,13 +93,13 @@ (type Analysers (Dictionary Text analysis.Handler)) (type Synthesizers (Dictionary Text synthesis.Handler)) (type Generators (Dictionary Text generation.Handler)) -(type Directives (Dictionary Text directive.Handler)) +(type Declarations (Dictionary Text declaration.Handler)) (type Bundles [Analysers Synthesizers Generators - Directives]) + Declarations]) (def empty_bundles Bundles @@ -109,8 +109,8 @@ (dictionary.empty text.hash)]) (def (loaded_document extension host @module expected actual document) - (All (_ expression directive) - (-> Text (generation.Host expression directive) module.ID (Sequence [Artifact (Set unit.ID)]) (Dictionary Text Binary) (Document .Module) + (All (_ expression declaration) + (-> Text (generation.Host expression declaration) module.ID (Sequence [Artifact (Set unit.ID)]) (Dictionary Text Binary) (Document .Module) (Try [(Document .Module) Bundles Output]))) (do [! try.monad] [[definitions bundles] (is (Try [Definitions Bundles Output]) @@ -119,23 +119,23 @@ (dictionary.empty text.hash)) bundles ..empty_bundles output (is Output sequence.empty)]) - (let [[analysers synthesizers generators directives] bundles] + (let [[analysers synthesizers generators declarations] bundles] (case input {.#Item [[[@artifact artifact_category mandatory_artifact?] artifact_dependencies] input']} (case (do ! [data (try.of_maybe (dictionary.value (format (%.nat @artifact) extension) actual)) .let [context [@module @artifact] - directive (at host ingest context data)]] + declaration (at host ingest context data)]] (case artifact_category {category.#Anonymous} (do ! [.let [output (sequence.suffix [@artifact {.#None} data] output)] - _ (at host re_learn context {.#None} directive)] + _ (at host re_learn context {.#None} declaration)] (in [definitions [analysers synthesizers generators - directives] + declarations] output])) {category.#Definition [name function_artifact]} @@ -145,70 +145,70 @@ [analysers synthesizers generators - directives] + declarations] output]) (do ! - [value (at host re_load context {.#None} directive)] + [value (at host re_load context {.#None} declaration)] (in [(dictionary.has name value definitions) [analysers synthesizers generators - directives] + declarations] output])))) {category.#Analyser extension} (do ! [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (at host re_load context {.#None} directive)] + value (at host re_load context {.#None} declaration)] (in [definitions [(dictionary.has extension (as analysis.Handler value) analysers) synthesizers generators - directives] + declarations] output])) {category.#Synthesizer extension} (do ! [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (at host re_load context {.#None} directive)] + value (at host re_load context {.#None} declaration)] (in [definitions [analysers (dictionary.has extension (as synthesis.Handler value) synthesizers) generators - directives] + declarations] output])) {category.#Generator extension} (do ! [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (at host re_load context {.#None} directive)] + value (at host re_load context {.#None} declaration)] (in [definitions [analysers synthesizers (dictionary.has extension (as generation.Handler value) generators) - directives] + declarations] output])) - {category.#Directive extension} + {category.#Declaration extension} (do ! [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (at host re_load context {.#None} directive)] + value (at host re_load context {.#None} declaration)] (in [definitions [analysers synthesizers generators - (dictionary.has extension (as directive.Handler value) directives)] + (dictionary.has extension (as declaration.Handler value) declarations)] output])) {category.#Custom name} (do ! [.let [output (sequence.suffix [@artifact {.#Some name} data] output)] - _ (at host re_learn context {.#Some name} directive)] + _ (at host re_learn context {.#Some name} declaration)] (in [definitions [analysers synthesizers generators - directives] + declarations] output])))) {try.#Success [definitions' bundles' output']} (again input' definitions' bundles' output') @@ -247,8 +247,8 @@ bundles]))) (def (load_definitions fs context @module host_environment entry) - (All (_ expression directive) - (-> (file.System Async) Context module.ID (generation.Host expression directive) + (All (_ expression declaration) + (-> (file.System Async) Context module.ID (generation.Host expression declaration) (archive.Entry .Module) (Async (Try [(archive.Entry .Module) Bundles])))) (do (try.with async.monad) @@ -322,8 +322,8 @@ (at try.monad conjoint))) (def (loaded_caches host_environment fs context purge load_order) - (All (_ expression directive) - (-> (generation.Host expression directive) (file.System Async) Context + (All (_ expression declaration) + (-> (generation.Host expression declaration) (file.System Async) Context Purge (dependency.Order .Module) (Async (Try (List [[descriptor.Module (archive.Entry .Module)] Bundles]))))) (do [! (try.with async.monad)] @@ -344,8 +344,8 @@ (in it))) (def (load_every_reserved_module customs configuration host_environment fs context import contexts archive) - (All (_ expression directive) - (-> (List Custom) Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context) Archive + (All (_ expression declaration) + (-> (List Custom) Configuration (generation.Host expression declaration) (file.System Async) Context Import (List //.Context) Archive (Async (Try [Archive .Lux Bundles])))) (do [! (try.with async.monad)] [pre_loaded_caches (..pre_loaded_caches customs fs context import contexts archive) @@ -365,18 +365,18 @@ analysis_state (..analysis_state (the context.#host context) configuration archive)] (in [archive analysis_state - (list#mix (function (_ [_ [+analysers +synthesizers +generators +directives]] - [analysers synthesizers generators directives]) + (list#mix (function (_ [_ [+analysers +synthesizers +generators +declarations]] + [analysers synthesizers generators declarations]) [(dictionary.composite +analysers analysers) (dictionary.composite +synthesizers synthesizers) (dictionary.composite +generators generators) - (dictionary.composite +directives directives)]) + (dictionary.composite +declarations declarations)]) ..empty_bundles loaded_caches)]))))) (def .public (thaw customs configuration host_environment fs context import contexts) - (All (_ expression directive) - (-> (List Custom) Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context) + (All (_ expression declaration) + (-> (List Custom) Configuration (generation.Host expression declaration) (file.System Async) Context Import (List //.Context) (Async (Try [Archive .Lux Bundles])))) (do async.monad [binary (at fs read (cache/archive.descriptor fs context))] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux index c59a31672..ee78db247 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux @@ -63,9 +63,9 @@ (at utf8.codec decoded) (at ! each (|>> as_expected - (is directive) - (sharing [directive] - (is directive + (is declaration) + (sharing [declaration] + (is declaration so_far)) (_.then so_far))))) (_.comment "Lux module" diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index 86960acb0..8d0f233b4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -64,9 +64,9 @@ (at encoding.utf8 decoded) (at try.monad each (|>> as_expected - (is directive) - (sharing [directive] - (is directive + (is declaration) + (sharing [declaration] + (is declaration so_far)) (..then so_far))))) (is _.Expression (_.manual ""))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux index 042b0fcdb..92975f25e 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -35,9 +35,9 @@ ["$" lux]]]]]) (def (write_module necessary_dependencies sequence [module_id output] so_far) - (All (_ directive) - (-> (Set unit.ID) (-> directive directive directive) [module.ID Output] directive - (Try directive))) + (All (_ declaration) + (-> (Set unit.ID) (-> declaration declaration declaration) [module.ID Output] declaration + (Try declaration))) (|> output sequence.list (list.all (function (_ [artifact_id custom content]) @@ -50,19 +50,19 @@ (at utf8.codec decoded) (at try.monad each (|>> as_expected - (is directive) - (sharing [directive] - (is directive + (is declaration) + (sharing [declaration] + (is declaration so_far)) (sequence so_far))))) so_far))) (def .public (package header code sequence scope) - (All (_ directive) - (-> directive - (-> directive Text) - (-> directive directive directive) - (-> directive directive) + (All (_ declaration) + (-> declaration + (-> declaration Text) + (-> declaration declaration declaration) + (-> declaration declaration) Packager)) (function (package host_dependencies archive program) (do [! try.monad] diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index ed08ed73f..c6e9c5de3 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -16,7 +16,7 @@ ["[0]" module] ["[0]" type]] ["[0]" generation] - ["[0]" directive (.only State+ Operation) + ["[0]" declaration (.only State+ Operation) ["[0]" total]] ["[0]" extension]] ["[0]" default @@ -58,26 +58,26 @@ "Till next time...") (def enter_module - (All (_ anchor expression directive) - (Operation anchor expression directive Any)) - (directive.lifted_analysis + (All (_ anchor expression declaration) + (Operation anchor expression declaration Any)) + (declaration.lifted_analysis (do phase.monad [_ (module.create 0 ..module)] (analysis.set_current_module ..module)))) (def (initialize Monad<!> Console<!> platform configuration generation_bundle) - (All (_ ! anchor expression directive) + (All (_ ! anchor expression declaration) (-> (Monad !) - (Console !) (Platform ! anchor expression directive) + (Console !) (Platform ! anchor expression declaration) Configuration - (generation.Bundle anchor expression directive) - (! (State+ anchor expression directive)))) + (generation.Bundle anchor expression declaration) + (! (State+ anchor expression declaration)))) (do Monad<!> [state (platform.initialize platform generation_bundle) state (platform.compile platform (has cli.#module syntax.prelude configuration) (has [extension.#state - directive.#analysis directive.#state + declaration.#analysis declaration.#state extension.#state .#info .#mode] {.#Interpreter} @@ -87,10 +87,10 @@ _ (at Console<!> write ..welcome_message)] (in state))) -(with_expansions [<Interpretation> (these (Operation anchor expression directive [Type Any]))] +(with_expansions [<Interpretation> (these (Operation anchor expression declaration [Type Any]))] - (def (interpret_directive code) - (All (_ anchor expression directive) + (def (interpret_declaration code) + (All (_ anchor expression declaration) (-> Code <Interpretation>)) (do phase.monad [_ (total.phase code) @@ -98,14 +98,14 @@ (in [Any []]))) (def (interpret_expression code) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Code <Interpretation>)) (do [! phase.monad] [state (extension.lifted phase.state) - .let [analyse (the [directive.#analysis directive.#phase] state) - synthesize (the [directive.#synthesis directive.#phase] state) - generate (the [directive.#generation directive.#phase] state)] - [_ codeT codeA] (directive.lifted_analysis + .let [analyse (the [declaration.#analysis declaration.#phase] state) + synthesize (the [declaration.#synthesis declaration.#phase] state) + generate (the [declaration.#generation declaration.#phase] state)] + [_ codeT codeA] (declaration.lifted_analysis (analysis.with_scope (type.with_fresh_env (do ! @@ -114,9 +114,9 @@ codeT (type.with_env (check.clean codeT))] (in [codeT codeA]))))) - codeS (directive.lifted_synthesis + codeS (declaration.lifted_synthesis (synthesize codeA))] - (directive.lifted_generation + (declaration.lifted_generation (generation.with_buffer (do ! [codeH (generate codeS) @@ -125,23 +125,23 @@ (in [codeT codeV])))))) (def (interpret configuration code) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Configuration Code <Interpretation>)) (function (_ state) (case (<| (phase.result' state) - (sharing [anchor expression directive] - (is (State+ anchor expression directive) + (sharing [anchor expression declaration] + (is (State+ anchor expression declaration) state) (is <Interpretation> - (interpret_directive code)))) + (interpret_declaration code)))) {try.#Success [state' output]} {try.#Success [state' output]} {try.#Failure error} - (if (ex.match? total.not_a_directive error) + (if (ex.match? total.not_a_declaration error) (<| (phase.result' state) - (sharing [anchor expression directive] - (is (State+ anchor expression directive) + (sharing [anchor expression declaration] + (is (State+ anchor expression declaration) state) (is <Interpretation> (interpret_expression code)))) @@ -149,43 +149,43 @@ ) (def (execute configuration code) - (All (_ anchor expression directive) - (-> Configuration Code (Operation anchor expression directive Text))) + (All (_ anchor expression declaration) + (-> Configuration Code (Operation anchor expression declaration Text))) (do phase.monad [[codeT codeV] (interpret configuration code) state phase.state] (in (/type.represent (the [extension.#state - directive.#analysis directive.#state + declaration.#analysis declaration.#state extension.#state] state) codeT codeV)))) -(type (Context anchor expression directive) +(type (Context anchor expression declaration) (Record [#configuration Configuration - #state (State+ anchor expression directive) + #state (State+ anchor expression declaration) #source Source])) -(with_expansions [<Context> (these (Context anchor expression directive))] +(with_expansions [<Context> (these (Context anchor expression declaration))] (def (read_eval_print context) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> <Context> (Try [<Context> Text]))) (do try.monad [.let [[_where _offset _code] (the #source context)] [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (the #source context)) [state' representation] (let [... TODO: Simplify ASAP - state (sharing [anchor expression directive] + state (sharing [anchor expression declaration] (is <Context> context) - (is (State+ anchor expression directive) + (is (State+ anchor expression declaration) (the #state context)))] (<| (phase.result' state) ... TODO: Simplify ASAP - (sharing [anchor expression directive] + (sharing [anchor expression declaration] (is <Context> context) - (is (Operation anchor expression directive Text) + (is (Operation anchor expression declaration Text) (execute (the #configuration context) input)))))] (in [(|> context (has #state state') @@ -193,11 +193,11 @@ representation])))) (def .public (run! Monad<!> Console<!> platform configuration generation_bundle) - (All (_ ! anchor expression directive) + (All (_ ! anchor expression declaration) (-> (Monad !) - (Console !) (Platform ! anchor expression directive) + (Console !) (Platform ! anchor expression declaration) Configuration - (generation.Bundle anchor expression directive) + (generation.Bundle anchor expression declaration) (! Any))) (do [! Monad<!>] [state (initialize Monad<!> Console<!> platform configuration)] diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 67bd9467b..0a29b79b7 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -35,7 +35,7 @@ ["[1]/[0]" program (.only Program)] ["[0]" syntax] ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] ["[0]" analysis (.only) [macro (.only Expander)]] [phase @@ -133,9 +133,9 @@ (with_expansions [<parameters> (these anchor expression artifact)] (def .public (compiler lux_compiler file_context - expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender - service - packager,package) + expander host_analysis platform generation_bundle host_declaration_bundle program anchorT,expressionT,declarationT extender + service + packager,package) (All (_ <parameters>) (-> (-> Any platform.Custom) Context @@ -143,7 +143,7 @@ analysis.Bundle (IO (Platform <parameters>)) (generation.Bundle <parameters>) - (-> phase.Wrapper (directive.Bundle <parameters>)) + (-> phase.Wrapper (declaration.Bundle <parameters>)) (Program expression artifact) [Type Type Type] (-> phase.Wrapper Extender) @@ -162,15 +162,15 @@ [state archive phase_wrapper] (sharing [<parameters>] (is (Platform <parameters>) platform) - (is (Async (Try [(directive.State+ <parameters>) + (is (Async (Try [(declaration.State+ <parameters>) Archive phase.Wrapper])) - (as_expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + (as_expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_declaration_bundle program anchorT,expressionT,declarationT extender import compilation_sources compilation_configuration)))) [archive state] (sharing [<parameters>] (is (Platform <parameters>) platform) - (is (Async (Try [Archive (directive.State+ <parameters>)])) + (is (Async (Try [Archive (declaration.State+ <parameters>)])) (as_expected (platform.compile lux_compiler phase_wrapper import file_context expander platform compilation [archive state])))) _ (cache.cache! (the platform.#file_system platform) file_context archive) host_dependencies (..load_host_dependencies (the platform.#file_system platform) compilation_host_dependencies) diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index f8d5dcc97..e6494e011 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -11,7 +11,7 @@ [tool [compiler ["[0]" analysis] - ["[0]" directive] + ["[0]" declaration] [phase [macro (.only Expander)] [generation (.only Bundle)]] @@ -42,11 +42,11 @@ )) (def .public (spec platform bundle expander program) - (All (_ anchor expression directive) - (-> (IO (Platform IO anchor expression directive)) - (Bundle anchor expression directive) + (All (_ anchor expression declaration) + (-> (IO (Platform IO anchor expression declaration)) + (Bundle anchor expression declaration) Expander - (-> expression directive) + (-> expression declaration) Test)) (do r.monad [_ (in []) @@ -58,9 +58,9 @@ expander program))]] (case ?state,runner,definer - {try.#Success [[directive_bundle directive_state] runner definer]} + {try.#Success [[declaration_bundle declaration_state] runner definer]} (..test runner definer - (the [directive.#analysis directive.#state] directive_state) + (the [declaration.#analysis declaration.#state] declaration_state) expander) {try.#Failure error} diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux index e6913e8df..c9da8e718 100644 --- a/stdlib/source/specification/compositor/common.lux +++ b/stdlib/source/specification/compositor/common.lux @@ -10,7 +10,7 @@ ["[0]" reference] ["[0]" analysis] ["[0]" synthesis (.only Synthesis)] - ["[0]" directive] + ["[0]" declaration] ["[0]" phase ["[0]" macro (.only Expander)] ["[0]" generation (.only Operation)] @@ -26,9 +26,9 @@ (-> Symbol Synthesis (Try Any))) (type .public (Instancer what) - (All (_ anchor expression directive) - (-> (Platform IO anchor expression directive) - (generation.State+ anchor expression directive) + (All (_ anchor expression declaration) + (-> (Platform IO anchor expression declaration) + (generation.State+ anchor expression declaration) what))) (def (runner (open "[0]") state) @@ -51,30 +51,30 @@ (do phase.monad [_ runtime expressionG (phase expressionS) - [host_name host_value host_directive] (generation.define! lux_name expressionG) + [host_name host_value host_declaration] (generation.define! lux_name expressionG) _ (generation.learn lux_name host_name)] (phase (synthesis.constant lux_name))))] (at host evaluate! "definer" definitionG)))) (def .public (executors target expander platform - analysis_bundle generation_bundle directive_bundle - program extender) - (All (_ anchor expression directive) - (-> Text Expander (Platform IO anchor expression directive) + analysis_bundle generation_bundle declaration_bundle + program extender) + (All (_ anchor expression declaration) + (-> Text Expander (Platform IO anchor expression declaration) analysis.Bundle - (generation.Bundle anchor expression directive) - (directive.Bundle anchor expression directive) - (-> expression directive) Extender - (IO (Try [(directive.State+ anchor expression directive) + (generation.Bundle anchor expression declaration) + (declaration.Bundle anchor expression declaration) + (-> expression declaration) Extender + (IO (Try [(declaration.State+ anchor expression declaration) Runner Definer])))) (do io.monad - [?state (platform.initialize target expander analysis_bundle platform generation_bundle directive_bundle program extender)] + [?state (platform.initialize target expander analysis_bundle platform generation_bundle declaration_bundle program extender)] (in (do try.monad - [[directive_bundle directive_state] ?state - .let [generation_state (the [directive.#generation - directive.#state] - directive_state)]] - (in [[directive_bundle directive_state] + [[declaration_bundle declaration_state] ?state + .let [generation_state (the [declaration.#generation + declaration.#state] + declaration_state)]] + (in [[declaration_bundle declaration_state] (..runner platform generation_state) (..definer platform generation_state)]))))) diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 58b5cd3fd..4ee1757d0 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -47,7 +47,7 @@ [language [lux ["[0]" generation] - ["[0]" directive] + ["[0]" declaration] ["[0]" analysis (.only) ["[0]" type] ["<[1]>" \\parser]] @@ -60,7 +60,7 @@ (.~~ (.these))))]]]]]] ["_" test (.only Test)]]] [\\library - ["[0]" / (.only analysis synthesis generation directive)]]))) + ["[0]" / (.only analysis synthesis generation declaration)]]))) (def dummy_generation "dummy generation") @@ -72,7 +72,7 @@ [my_analysis] [my_synthesis] [my_generation] - [my_directive] + [my_declaration] ) ... Generation @@ -133,52 +133,52 @@ @.php (php.string self) @.scheme (scheme.string self)))) - ... Directive - (directive (..my_directive self phase archive [expression <code>.any]) - (do [! phase.monad] - [analysis_phase directive.analysis - expressionA (<| directive.lifted_analysis - (type.expecting .Any) - (analysis_phase archive expression)) - - synthesis_phase directive.synthesis - expressionS (directive.lifted_synthesis - (synthesis_phase archive expressionA)) - - generation_phase directive.generation - expressionG (directive.lifted_generation - (generation_phase archive expressionS)) - - _ (directive.lifted_generation - (generation.with_new_context archive unit.none - (do ! - [[module_id artifact_id] (generation.context archive) - .let [commentary (format "Successfully installed directive " (%.text self) "!")] - _ (generation.save! artifact_id {.#None} - (for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] - (<| [$class] - (try.else (binary.empty 0)) - (try#each (binaryF.result class.format)) - (class.class version.v6_0 class.public - (name.internal $class) - {.#None} - (name.internal "java.lang.Object") - (list) - (list) - (list) - sequence.empty))) - @.js (js.comment commentary - (js.statement (js.string commentary))) - @.python (python.comment commentary - (python.statement (python.string commentary))) - @.lua (lua.comment commentary - (lua.statement expressionG)) - @.ruby (ruby.comment commentary - (ruby.statement (ruby.string commentary)))))] - (generation.log! commentary))))] - (in directive.no_requirements))) - - (`` ((~~ (static ..my_directive)) (n.* 2 3))) + ... Declaration + (declaration (..my_declaration self phase archive [expression <code>.any]) + (do [! phase.monad] + [analysis_phase declaration.analysis + expressionA (<| declaration.lifted_analysis + (type.expecting .Any) + (analysis_phase archive expression)) + + synthesis_phase declaration.synthesis + expressionS (declaration.lifted_synthesis + (synthesis_phase archive expressionA)) + + generation_phase declaration.generation + expressionG (declaration.lifted_generation + (generation_phase archive expressionS)) + + _ (declaration.lifted_generation + (generation.with_new_context archive unit.none + (do ! + [[module_id artifact_id] (generation.context archive) + .let [commentary (format "Successfully installed declaration " (%.text self) "!")] + _ (generation.save! artifact_id {.#None} + (for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] + (<| [$class] + (try.else (binary.empty 0)) + (try#each (binaryF.result class.format)) + (class.class version.v6_0 class.public + (name.internal $class) + {.#None} + (name.internal "java.lang.Object") + (list) + (list) + (list) + sequence.empty))) + @.js (js.comment commentary + (js.statement (js.string commentary))) + @.python (python.comment commentary + (python.statement (python.string commentary))) + @.lua (lua.comment commentary + (lua.statement expressionG)) + @.ruby (ruby.comment commentary + (ruby.statement (ruby.string commentary)))))] + (generation.log! commentary))))] + (in declaration.no_requirements))) + + (`` ((~~ (static ..my_declaration)) (n.* 2 3))) )) (def .public test @@ -201,6 +201,6 @@ (`` ((~~ (static ..my_generation)) expected))) (text#= ..dummy_generation (`` ((~~ (static ..dummy_generation)))))))) - (_.coverage [/.directive] + (_.coverage [/.declaration] true) ))))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux index 53d3abd61..a2d2d77bf 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux @@ -114,8 +114,8 @@ [/.definition (is category.Definition [expected_name {.#None}]) /.definitions category.#Definition /.analyser expected_name] [/.analyser expected_name /.analysers category.#Analyser /.synthesizer expected_name] [/.synthesizer expected_name /.synthesizers category.#Synthesizer /.generator expected_name] - [/.generator expected_name /.generators category.#Generator /.directive expected_name] - [/.directive expected_name /.directives category.#Directive /.custom expected_name] + [/.generator expected_name /.generators category.#Generator /.declaration expected_name] + [/.declaration expected_name /.declarations category.#Declaration /.custom expected_name] [/.custom expected_name /.customs category.#Custom /.definition (is category.Definition [expected_name {.#None}])] )) (_.coverage [/.id] @@ -130,7 +130,7 @@ [/.analyser expected_name |>] [/.synthesizer expected_name |>] [/.generator expected_name |>] - [/.directive expected_name |>] + [/.declaration expected_name |>] [/.custom expected_name |>] )))) (_.coverage [/.artifacts] @@ -155,7 +155,7 @@ [/.analyser /.analysers text.equivalence (|>>)] [/.synthesizer /.synthesizers text.equivalence (|>>)] [/.generator /.generators text.equivalence (|>>)] - [/.directive /.directives text.equivalence (|>>)] + [/.declaration /.declarations text.equivalence (|>>)] [/.custom /.customs text.equivalence (|>>)] )))) (_.coverage [/.format /.parser] @@ -174,7 +174,7 @@ [/.analyser expected_name |>] [/.synthesizer expected_name |>] [/.generator expected_name |>] - [/.directive expected_name |>] + [/.declaration expected_name |>] [/.custom expected_name |>] )))) ))))) |