From 853d28f803e75d125915a81dcdcd140513efe3d2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 26 Jun 2022 19:37:45 -0400 Subject: Re-named directives to declarations. --- lux-bootstrapper/src/lux/analyser/lux.clj | 6 +- lux-bootstrapper/src/lux/base.clj | 8 +- lux-jvm/source/program.lux | 4 +- lux-mode/lux-mode.el | 5 +- stdlib/source/documentation/lux/data/binary.lux | 116 ++- stdlib/source/documentation/lux/data/bit.lux | 15 +- .../source/documentation/lux/data/collection.lux | 2 +- .../documentation/lux/data/collection/array.lux | 154 ++-- .../documentation/lux/data/collection/bits.lux | 60 +- .../lux/data/collection/dictionary.lux | 130 ++- .../lux/data/collection/dictionary/ordered.lux | 99 +-- .../lux/data/collection/dictionary/plist.lux | 60 +- .../documentation/lux/data/collection/list.lux | 347 ++++---- .../documentation/lux/data/collection/queue.lux | 65 +- .../lux/data/collection/queue/priority.lux | 24 +- .../documentation/lux/data/collection/sequence.lux | 96 +- .../documentation/lux/data/collection/set.lux | 51 +- .../lux/data/collection/set/multi.lux | 75 +- .../lux/data/collection/set/ordered.lux | 67 +- .../documentation/lux/data/collection/stack.lux | 40 +- .../documentation/lux/data/collection/stream.lux | 85 +- .../documentation/lux/data/collection/tree.lux | 57 +- .../lux/data/collection/tree/finger.lux | 66 +- .../lux/data/collection/tree/zipper.lux | 49 +- stdlib/source/documentation/lux/data/color.lux | 194 ++-- .../source/documentation/lux/data/color/named.lux | 460 ++++------ stdlib/source/documentation/lux/data/format.lux | 2 +- stdlib/source/documentation/lux/data/identity.lux | 13 +- stdlib/source/documentation/lux/data/product.lux | 59 +- stdlib/source/documentation/lux/data/sum.lux | 38 +- stdlib/source/documentation/lux/data/text.lux | 209 ++--- .../source/documentation/lux/data/text/buffer.lux | 13 +- .../documentation/lux/data/text/encoding.lux | 452 ++++------ .../documentation/lux/data/text/encoding/utf8.lux | 8 +- .../source/documentation/lux/data/text/escape.lux | 41 +- .../source/documentation/lux/data/text/regex.lux | 124 ++- .../source/documentation/lux/data/text/unicode.lux | 2 +- .../documentation/lux/data/text/unicode/block.lux | 381 +++----- .../documentation/lux/data/text/unicode/set.lux | 24 +- stdlib/source/documentation/lux/extension.lux | 14 +- stdlib/source/documentation/lux/macro/local.lux | 2 +- stdlib/source/documentation/lux/tool.lux | 4 +- .../lux/tool/compiler/language/lux/declaration.lux | 35 + .../lux/tool/compiler/language/lux/directive.lux | 35 - .../lux/tool/compiler/language/lux/generation.lux | 2 +- stdlib/source/library/lux/extension.lux | 6 +- stdlib/source/library/lux/ffi/export.js.lux | 66 +- stdlib/source/library/lux/ffi/export.lua.lux | 90 +- stdlib/source/library/lux/ffi/export.py.lux | 52 +- stdlib/source/library/lux/ffi/export.rb.lux | 72 +- .../source/library/lux/target/jvm/reflection.lux | 2 +- stdlib/source/library/lux/target/jvm/type/lux.lux | 15 +- .../library/lux/tool/compiler/default/init.lux | 148 ++-- .../library/lux/tool/compiler/default/platform.lux | 92 +- .../lux/tool/compiler/language/lux/declaration.lux | 102 +++ .../lux/tool/compiler/language/lux/directive.lux | 102 --- .../lux/tool/compiler/language/lux/generation.lux | 142 +-- .../compiler/language/lux/phase/declaration.lux | 125 +++ .../tool/compiler/language/lux/phase/directive.lux | 125 --- .../language/lux/phase/extension/analysis/jvm.lux | 46 +- .../lux/phase/extension/declaration/jvm.lux | 978 +++++++++++++++++++++ .../lux/phase/extension/declaration/lux.lux | 570 ++++++++++++ .../language/lux/phase/extension/directive/jvm.lux | 978 --------------------- .../language/lux/phase/extension/directive/lux.lux | 570 ------------ .../lux/phase/extension/generation/php/common.lux | 14 +- .../language/lux/phase/generation/extension.lux | 10 +- .../jvm/function/method/implementation.lux | 2 +- .../phase/generation/jvm/function/method/init.lux | 2 +- .../phase/generation/jvm/function/method/reset.lux | 2 +- .../language/lux/phase/generation/jvm/host.lux | 2 +- .../language/lux/phase/generation/lua/loop.lux | 42 +- .../language/lux/phase/generation/php/case.lux | 6 +- .../language/lux/phase/generation/php/loop.lux | 28 +- .../language/lux/phase/generation/python/case.lux | 8 +- .../lux/phase/generation/python/function.lux | 58 +- .../language/lux/phase/generation/python/loop.lux | 36 +- .../language/lux/phase/generation/reference.lux | 8 +- .../lux/tool/compiler/language/lux/program.lux | 4 +- .../compiler/meta/archive/artifact/category.lux | 4 +- .../lux/tool/compiler/meta/archive/registry.lux | 8 +- .../compiler/meta/cache/dependency/artifact.lux | 8 +- .../library/lux/tool/compiler/meta/io/archive.lux | 68 +- .../lux/tool/compiler/meta/packager/ruby.lux | 6 +- .../lux/tool/compiler/meta/packager/scheme.lux | 6 +- .../lux/tool/compiler/meta/packager/script.lux | 22 +- stdlib/source/library/lux/tool/interpreter.lux | 80 +- stdlib/source/program/compositor.lux | 16 +- stdlib/source/specification/compositor.lux | 14 +- stdlib/source/specification/compositor/common.lux | 38 +- stdlib/source/test/lux/extension.lux | 100 +-- .../lux/tool/compiler/meta/archive/registry.lux | 10 +- 91 files changed, 4016 insertions(+), 4660 deletions(-) create mode 100644 stdlib/source/documentation/lux/tool/compiler/language/lux/declaration.lux delete mode 100644 stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux create mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/declaration.lux delete mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/directive.lux create mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/declaration.lux delete mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux create mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux create mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/lux.lux delete mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux delete mode 100644 stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux 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 [] - [(`` (documentation: - (format "Yields value under the " (~~ (template.text [])) "imum key.")))] + ($.documentation /.key? + "" + [(key? dict key)]) - [/.min] - [/.max] - ) + (~~ (with_template [] + [(`` ($.documentation + (format "Yields value under the " (~~ (template.text [])) "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 [ ] - [(documentation: - )] - - [/.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 [ ] + [($.documentation + )] + + [/.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] .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 [] - [(`` (documentation: - (format "A " - (text.replaced "_" "-" (~~ (template.text []))) - " 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 [] + [(`` ($.documentation + (format "A " + (text.replaced "_" "-" (~~ (template.text []))) + " 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 [] - [(documentation: - (let [[red green blue] (//.rgb ) - [_ name] (symbol )] - (format "R:" (hex#encoded red) - " G:" (hex#encoded green) - " B:" (hex#encoded blue) - " | " (text.replaced "_" " " name))))] +(`` (.def .public documentation + (.List $.Module) + ($.module /._ + "" + [(~~ (with_template [] + [($.documentation + (let [[red green blue] (//.rgb ) + [_ name] (symbol )] + (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 [] - [(documentation: - (format "'" (/.name ) "' text encoding. "))] + (documentation: /.Encoding + "Encoding formats for text.") - [/.ascii] + (~~ (with_template [] + [(documentation: + (format "'" (/.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 "(?\d{3})-\k-(\d{4})") - (regex "(?\d{3})-\k-(\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 "(?\d{3})-\k-(\d{4})") + (regex "(?\d{3})-\k-(\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 [] - [(documentation: - (let [[_ name] (symbol )] - (format (hex#encoded (/.start )) - "-" (hex#encoded (/.end )) - " | " (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 [] + [($.documentation + (let [[_ name] (symbol )] + (format (hex#encoded (/.start )) + "-" (hex#encoded (/.end )) + " | " (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 .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 .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/declaration.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/declaration.lux new file mode 100644 index 000000000..ff1036122 --- /dev/null +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/declaration.lux @@ -0,0 +1,35 @@ +(.require + [library + [lux (.except char) + ["$" documentation (.only documentation:)] + [data + [text (.only \n) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) + +(.def .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.Component) + ($.default /.State) + ($.default /.Import) + ($.default /.Requirements) + ($.default /.no_requirements) + ($.default /.merge_requirements) + ($.default /.State+) + ($.default /.Operation) + ($.default /.Phase) + ($.default /.Handler) + ($.default /.Bundle) + ($.default /.analysis) + ($.default /.synthesis) + ($.default /.generation) + ($.default /.lifted_analysis) + ($.default /.lifted_synthesis) + ($.default /.lifted_generation) + ($.default /.set_current_module)] + [])) diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux deleted file mode 100644 index ff1036122..000000000 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/directive.lux +++ /dev/null @@ -1,35 +0,0 @@ -(.require - [library - [lux (.except char) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.default /.Component) - ($.default /.State) - ($.default /.Import) - ($.default /.Requirements) - ($.default /.no_requirements) - ($.default /.merge_requirements) - ($.default /.State+) - ($.default /.Operation) - ($.default /.Phase) - ($.default /.Handler) - ($.default /.Bundle) - ($.default /.analysis) - ($.default /.synthesis) - ($.default /.generation) - ($.default /.lifted_analysis) - ($.default /.lifted_synthesis) - ($.default /.lifted_generation) - ($.default /.set_current_module)] - [])) diff --git a/stdlib/source/documentation/lux/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)) (.form (all <>.and .any @@ -42,7 +42,7 @@ (with_template [ ] [(def .public - (syntax (_ [[name extension phase archive inputs] (..declaration (` )) + (syntax (_ [[name extension phase archive inputs] (..declarationP (` )) body .any]) (let [g!name (code.local extension) g!phase (code.local phase) @@ -66,5 +66,5 @@ [.any .end .and .result "lux def analysis" analysis] [.any .end .and .result "lux def synthesis" synthesis] [.any .end .and .result "lux def generation" generation] - [.any .end .and .result "lux def directive" directive] + [.any .end .and .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 [ (static.random (|>> %.nat (%.format "lua export ") code.text) random.nat)] - (directive ( self phase archive [name .text - term .any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration ( self phase archive [name .text + term .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 .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 [ (static.random (|>> %.nat (%.format "lua export ") code.text) random.nat)] - (directive ( self phase archive [name .text - term .any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration ( self phase archive [name .text + term .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 .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 [ (static.random (|>> %.nat (%.format "python export ") code.text) random.nat)] - (directive ( self phase archive [name .text - term .any]) - (do [! phase.monad] - [next directive.analysis - [_ term] (<| directive.lifted_analysis - type.inferring - (next archive term)) + (declaration ( self phase archive [name .text + term .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 .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 [ (static.random (|>> %.nat (%.format "ruby export ") code.text) random.nat)] - (directive ( self phase archive [global? .bit - name .text - term .any]) - (do [! phase.monad] - [next directive.analysis - [type term] (<| directive.lifted_analysis - analysis.inferring - (next archive term)) + (declaration ( self phase archive [global? .bit + name .text + term .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 .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 [] - [(primitive .public ( class) Any)] + [(:.primitive .public ( 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 (.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 [ (these anchor expression directive) +(with_expansions [ (these anchor expression declaration) (these ///generation.Operation )] (type .public (Platform ) (Record [#file_system (file.System Async) - #host (///generation.Host expression directive) + #host (///generation.Host expression declaration) #phase (///generation.Phase ) #runtime ( [Registry Output]) #phase_wrapper (-> Archive ( ///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 [ (these (Platform )) - (these (///directive.State+ )) + (these (///declaration.State+ )) (these (///generation.Bundle ))] (def (format //) @@ -175,10 +175,10 @@ (def (process_runtime archive platform) (All (_ ) (-> Archive - (///directive.Operation - [Archive (archive.Entry .Module)]))) + (///declaration.Operation + [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 (_ ) @@ -200,24 +200,24 @@ [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler )) - (Dictionary Text (///directive.Handler ))] + (Dictionary Text (///declaration.Handler ))] .Lux (Try ))) (|> (sharing [] (is state) - (is (///directive.Operation Any) + (is (///declaration.Operation 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 (Try [ ///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 (_ ) - (-> (-> ///phase.Wrapper (///directive.Bundle )) + (-> (-> ///phase.Wrapper (///declaration.Bundle )) ///phase.Wrapper [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler )) - (Dictionary Text (///directive.Handler ))] + (Dictionary Text (///declaration.Handler ))] [(Dictionary Text ///analysis.Handler) (Dictionary Text ///synthesis.Handler) (Dictionary Text (///generation.Handler )) - (Dictionary Text (///directive.Handler ))])) + (Dictionary Text (///declaration.Handler ))])) [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 (_ ) (-> context.Context @@ -256,8 +256,8 @@ ///analysis.Bundle - (-> ///phase.Wrapper (///directive.Bundle )) - (Program expression directive) + (-> ///phase.Wrapper (///declaration.Bundle )) + (Program expression declaration) [Type Type Type] (-> ///phase.Wrapper Extender) Import (List _io.Context) Configuration (Async (Try [ 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 (_ ) - (-> (Program expression directive) + (-> (Program expression declaration) (Async (Try [///phase.Wrapper ])))) (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 (_ ) (-> descriptor.Module 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 (_ ) (-> )) (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 from) (the state))] (in (has 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 (_ ) (-> )) (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 (_ ) (-> descriptor.Module )) - (|> (///directive.set_current_module module) + (|> (///declaration.set_current_module module) (///phase.result' state) try.trusted product.left)) @@ -685,9 +685,9 @@ (Try [ (Either (///.Compilation .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/declaration.lux b/stdlib/source/library/lux/tool/compiler/language/lux/declaration.lux new file mode 100644 index 000000000..1f2b4505a --- /dev/null +++ b/stdlib/source/library/lux/tool/compiler/language/lux/declaration.lux @@ -0,0 +1,102 @@ +(.require + [library + [lux (.except Module) + [abstract + [monad (.only do)]] + [control + ["[0]" try]] + [data + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] + [// + ["[0]" analysis] + ["[0]" synthesis] + ["[0]" generation] + [phase + ["[0]" extension]] + [/// + ["[0]" phase] + [meta + [archive + [module + [descriptor (.only Module)]]]]]]) + +(type .public (Component state phase) + (Record + [#state state + #phase phase])) + +(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 declaration) + (generation.Phase anchor expression declaration))])) + +(type .public Import + (Record + [#module Module + #alias Text])) + +(type .public Requirements + (Record + [#imports (List Import) + #referrals (List Code)])) + +(def .public no_requirements + Requirements + [#imports (list) + #referrals (list)]) + +(def .public (merge_requirements left right) + (-> Requirements Requirements Requirements) + [#imports (list#composite (the #imports left) (the #imports right)) + #referrals (list#composite (the #referrals left) (the #referrals right))]) + +(with_template [ ] + [(type .public ( anchor expression declaration) + ( (..State anchor expression declaration) Code Requirements))] + + [State+ extension.State] + [Operation extension.Operation] + [Phase extension.Phase] + [Handler extension.Handler] + [Bundle extension.Bundle] + ) + +(with_template [ ] + [(def .public + (All (_ anchor expression declaration) + (Operation anchor expression declaration )) + (function (_ [bundle state]) + {try.#Success [[bundle state] (the [ ..#phase] state)]}))] + + [analysis ..#analysis analysis.Phase] + [synthesis ..#synthesis synthesis.Phase] + [generation ..#generation (generation.Phase anchor expression declaration)] + ) + +(with_template [ ] + [(def .public + (All (_ anchor expression declaration output) + (-> ( output) + (Operation anchor expression declaration output))) + (|>> (phase.sub [(the [ ..#state]) + (has [ ..#state])]) + extension.lifted))] + + [lifted_analysis ..#analysis analysis.Operation] + [lifted_synthesis ..#synthesis synthesis.Operation] + [lifted_generation ..#generation (generation.Operation anchor expression declaration)] + ) + +(def .public (set_current_module module) + (All (_ anchor expression declaration) + (-> Module (Operation anchor expression declaration Any))) + (do phase.monad + [_ (..lifted_analysis + (analysis.set_current_module module))] + (..lifted_generation + (generation.enter_module module)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux deleted file mode 100644 index 380e48d63..000000000 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ /dev/null @@ -1,102 +0,0 @@ -(.require - [library - [lux (.except Module) - [abstract - [monad (.only do)]] - [control - ["[0]" try]] - [data - [collection - ["[0]" list (.use "[1]#[0]" monoid)]]]]] - [// - ["[0]" analysis] - ["[0]" synthesis] - ["[0]" generation] - [phase - ["[0]" extension]] - [/// - ["[0]" phase] - [meta - [archive - [module - [descriptor (.only Module)]]]]]]) - -(type .public (Component state phase) - (Record - [#state state - #phase phase])) - -(type .public (State anchor expression directive) - (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))])) - -(type .public Import - (Record - [#module Module - #alias Text])) - -(type .public Requirements - (Record - [#imports (List Import) - #referrals (List Code)])) - -(def .public no_requirements - Requirements - [#imports (list) - #referrals (list)]) - -(def .public (merge_requirements left right) - (-> Requirements Requirements Requirements) - [#imports (list#composite (the #imports left) (the #imports right)) - #referrals (list#composite (the #referrals left) (the #referrals right))]) - -(with_template [ ] - [(type .public ( anchor expression directive) - ( (..State anchor expression directive) Code Requirements))] - - [State+ extension.State] - [Operation extension.Operation] - [Phase extension.Phase] - [Handler extension.Handler] - [Bundle extension.Bundle] - ) - -(with_template [ ] - [(def .public - (All (_ anchor expression directive) - (Operation anchor expression directive )) - (function (_ [bundle state]) - {try.#Success [[bundle state] (the [ ..#phase] state)]}))] - - [analysis ..#analysis analysis.Phase] - [synthesis ..#synthesis synthesis.Phase] - [generation ..#generation (generation.Phase anchor expression directive)] - ) - -(with_template [ ] - [(def .public - (All (_ anchor expression directive output) - (-> ( output) - (Operation anchor expression directive output))) - (|>> (phase.sub [(the [ ..#state]) - (has [ ..#state])]) - extension.lifted))] - - [lifted_analysis ..#analysis analysis.Operation] - [lifted_synthesis ..#synthesis synthesis.Operation] - [lifted_generation ..#generation (generation.Operation anchor expression directive)] - ) - -(def .public (set_current_module module) - (All (_ anchor expression directive) - (-> Module (Operation anchor expression directive Any))) - (do phase.monad - [_ (..lifted_analysis - (analysis.set_current_module module))] - (..lifted_generation - (generation.enter_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 [ ] - [(type .public ( anchor expression directive) - ( (State anchor expression directive) Synthesis expression))] + [(type .public ( anchor expression declaration) + ( (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 ) (def .public - (All (_ anchor expression directive output) ) + (All (_ anchor expression declaration output) ) (function (_ body) (function (_ [bundle state]) (case (body [bundle (has {.#Some } state)]) @@ -134,8 +134,8 @@ {try.#Failure error})))) (def .public - (All (_ anchor expression directive) - (Operation anchor expression directive )) + (All (_ anchor expression declaration) + (Operation anchor expression declaration )) (function (_ (^.let stateE [bundle state])) (case (the state) {.#Some output} @@ -145,66 +145,66 @@ (exception.except [])))) (def .public ( value) - (All (_ anchor expression directive) - (-> (Operation anchor expression directive Any))) + (All (_ anchor expression declaration) + (-> (Operation anchor expression declaration Any))) (function (_ [bundle state]) {try.#Success [[bundle (has {.#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 [ ] [(`` (def .public ( it (~~ (template.spliced )) dependencies) - (All (_ anchor expression directive) - (-> (~~ (template.spliced )) (Set unit.ID) (Operation anchor expression directive artifact.ID))) + (All (_ anchor expression declaration) + (-> (~~ (template.spliced )) (Set unit.ID) (Operation anchor expression declaration artifact.ID))) (function (_ (^.let stateE [bundle state])) (let [[id registry'] ( it 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/declaration.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/declaration.lux new file mode 100644 index 000000000..806308519 --- /dev/null +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/declaration.lux @@ -0,0 +1,125 @@ +(.require + [library + [lux (.except) + ["[0]" meta] + [abstract + ["[0]" monad (.only do)]] + [control + ["[0]" try] + ["[0]" exception (.only exception)]] + [data + [text + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" mix monoid)]]]]] + ["[0]" // + ["[1][0]" extension] + ["[1][0]" analysis] + ["/[1]" // + ["/" declaration (.only Operation Phase)] + ["[1][0]" analysis (.only) + ["[0]" evaluation] + ["[1]/[0]" macro (.only Expander)] + ["[1]/[0]" type]] + [/// + ["//" phase] + [reference (.only) + [variable (.only)]] + [meta + [archive (.only Archive)]]]]]) + +(exception .public (not_a_declaration [code Code]) + (exception.report + "Declaration" (%.code code))) + +(exception .public (invalid_macro_call [code Code]) + (exception.report + "Code" (%.code code))) + +(exception .public (macro_was_not_found [name Symbol]) + (exception.report + "Name" (%.symbol name))) + +(type Eval + (-> Type Code (Meta Any))) + +(def (meta_eval archive bundle compiler_eval) + (-> Archive ///analysis.Bundle evaluation.Eval + Eval) + (function (_ type code lux) + (case (compiler_eval archive type code [bundle lux]) + {try.#Success [[_bundle lux'] value]} + {try.#Success [lux' value]} + + {try.#Failure error} + {try.#Failure error}))) + +(def (requiring phase archive expansion) + (All (_ anchor expression declaration) + (-> (Phase anchor expression declaration) Archive (List Code) + (Operation anchor expression declaration /.Requirements))) + (function (_ state) + (loop (again [state state + input expansion + output /.no_requirements]) + (case input + {.#End} + {try.#Success [state output]} + + {.#Item head tail} + (case (phase archive head state) + {try.#Success [state' head']} + (again state' tail (/.merge_requirements head' output)) + + {try.#Failure error} + {try.#Failure error}))))) + +(with_expansions [ (these [|form_location| {.#Form (list.partial [|text_location| {.#Text "lux def module"}] annotations)}])] + (def .public (phase wrapper expander) + (-> //.Wrapper Expander Phase) + (let [analysis (//analysis.phase expander)] + (function (again archive code) + (do [! //.monad] + [state //.state + .let [compiler_eval (meta_eval archive + (the [//extension.#state /.#analysis /.#state //extension.#bundle] state) + (evaluation.evaluator expander + (the [//extension.#state /.#synthesis /.#state] state) + (the [//extension.#state /.#generation /.#state] state) + (the [//extension.#state /.#generation /.#phase] state))) + extension_eval (as Eval (wrapper (as_expected compiler_eval)))] + _ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))] + (case code + (pattern [_ {.#Form (list.partial [_ {.#Text name}] inputs)}]) + (//extension.apply archive again [name inputs]) + + (pattern [_ {.#Form (list.partial macro inputs)}]) + (do ! + [expansion (/.lifted_analysis + (do ! + [macroA (<| (///analysis/type.expecting Macro) + (analysis archive macro))] + (case macroA + (pattern (///analysis.constant macro_name)) + (do ! + [?macro (//extension.lifted (meta.macro macro_name)) + macro (case ?macro + {.#Some macro} + (in macro) + + {.#None} + (//.except ..macro_was_not_found macro_name))] + (//extension.lifted (///analysis/macro.expansion expander macro_name macro inputs))) + + _ + (//.except ..invalid_macro_call code))))] + (case expansion + (pattern (list.partial referrals)) + (|> (again archive ) + (at ! each (revised /.#referrals (list#composite referrals)))) + + _ + (..requiring again archive expansion))) + + _ + (//.except ..not_a_declaration code))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux deleted file mode 100644 index cffe0d681..000000000 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux +++ /dev/null @@ -1,125 +0,0 @@ -(.require - [library - [lux (.except) - ["[0]" meta] - [abstract - ["[0]" monad (.only do)]] - [control - ["[0]" try] - ["[0]" exception (.only exception)]] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list (.use "[1]#[0]" mix monoid)]]]]] - ["[0]" // - ["[1][0]" extension] - ["[1][0]" analysis] - ["/[1]" // - ["/" directive (.only Operation Phase)] - ["[1][0]" analysis (.only) - ["[0]" evaluation] - ["[1]/[0]" macro (.only Expander)] - ["[1]/[0]" type]] - [/// - ["//" phase] - [reference (.only) - [variable (.only)]] - [meta - [archive (.only Archive)]]]]]) - -(exception .public (not_a_directive [code Code]) - (exception.report - "Directive" (%.code code))) - -(exception .public (invalid_macro_call [code Code]) - (exception.report - "Code" (%.code code))) - -(exception .public (macro_was_not_found [name Symbol]) - (exception.report - "Name" (%.symbol name))) - -(type Eval - (-> Type Code (Meta Any))) - -(def (meta_eval archive bundle compiler_eval) - (-> Archive ///analysis.Bundle evaluation.Eval - Eval) - (function (_ type code lux) - (case (compiler_eval archive type code [bundle lux]) - {try.#Success [[_bundle lux'] value]} - {try.#Success [lux' value]} - - {try.#Failure error} - {try.#Failure error}))) - -(def (requiring phase archive expansion) - (All (_ anchor expression directive) - (-> (Phase anchor expression directive) Archive (List Code) - (Operation anchor expression directive /.Requirements))) - (function (_ state) - (loop (again [state state - input expansion - output /.no_requirements]) - (case input - {.#End} - {try.#Success [state output]} - - {.#Item head tail} - (case (phase archive head state) - {try.#Success [state' head']} - (again state' tail (/.merge_requirements head' output)) - - {try.#Failure error} - {try.#Failure error}))))) - -(with_expansions [ (these [|form_location| {.#Form (list.partial [|text_location| {.#Text "lux def module"}] annotations)}])] - (def .public (phase wrapper expander) - (-> //.Wrapper Expander Phase) - (let [analysis (//analysis.phase expander)] - (function (again archive code) - (do [! //.monad] - [state //.state - .let [compiler_eval (meta_eval archive - (the [//extension.#state /.#analysis /.#state //extension.#bundle] state) - (evaluation.evaluator expander - (the [//extension.#state /.#synthesis /.#state] state) - (the [//extension.#state /.#generation /.#state] state) - (the [//extension.#state /.#generation /.#phase] state))) - extension_eval (as Eval (wrapper (as_expected compiler_eval)))] - _ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))] - (case code - (pattern [_ {.#Form (list.partial [_ {.#Text name}] inputs)}]) - (//extension.apply archive again [name inputs]) - - (pattern [_ {.#Form (list.partial macro inputs)}]) - (do ! - [expansion (/.lifted_analysis - (do ! - [macroA (<| (///analysis/type.expecting Macro) - (analysis archive macro))] - (case macroA - (pattern (///analysis.constant macro_name)) - (do ! - [?macro (//extension.lifted (meta.macro macro_name)) - macro (case ?macro - {.#Some macro} - (in macro) - - {.#None} - (//.except ..macro_was_not_found macro_name))] - (//extension.lifted (///analysis/macro.expansion expander macro_name macro inputs))) - - _ - (//.except ..invalid_macro_call code))))] - (case expansion - (pattern (list.partial referrals)) - (|> (again archive ) - (at ! each (revised /.#referrals (list#composite referrals)))) - - _ - (..requiring again archive expansion))) - - _ - (//.except ..not_a_directive 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 .text .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)) (.tuple (<>.and .text .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 @@ (.tuple (<>.some ..class)) .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/declaration/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux new file mode 100644 index 000000000..9fdfb4d7c --- /dev/null +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/declaration/jvm.lux @@ -0,0 +1,978 @@ +(.require + [library + [lux (.except Type Definition Primitive) + ["[0]" ffi (.only import)] + [abstract + ["[0]" monad (.only do)]] + [control + ["<>" parser (.use "[1]#[0]" monad)] + ["[0]" pipe] + ["[0]" try (.only Try) (.use "[1]#[0]" functor)] + ["[0]" exception]] + [data + ["[0]" product] + [binary (.only Binary) + ["[0]" \\format]] + ["[0]" text + ["%" \\format (.only format)] + ["<[1]>" \\parser]] + [collection + ["[0]" list (.use "[1]#[0]" functor mix)] + ["[0]" dictionary] + ["[0]" sequence] + ["[0]" set (.only Set)]]] + [macro + ["^" pattern] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] + [math + [number + ["n" nat] + ["[0]" i32]]] + [target + [jvm + ["_" bytecode (.only Bytecode) (.use "[1]#[0]" monad)] + ["[0]" modifier (.only Modifier) (.use "[1]#[0]" monoid)] + ["[0]" attribute] + ["[0]" field] + ["[0]" version] + ["[0]" method (.only Method)] + ["[0]" class] + ["[0]" constant (.only) + ["[0]" pool (.only Resource)]] + [encoding + ["[0]" name (.only External)]] + ["[0]" type (.only Type Constraint Argument Typed) + [category (.only Void Value Return Primitive Object Class Array Var Parameter)] + ["[0]T" lux (.only Mapping)] + ["[0]" signature] + ["[0]" reflection] + ["[0]" descriptor (.only Descriptor)] + ["[0]" parser]]]] + [tool + [compiler + ["[0]" phase] + [reference + [variable (.only Register)]] + [meta + [archive (.only Archive) + ["[0]" artifact] + ["[0]" unit]] + ["[0]" cache + [dependency + ["[1]" artifact]]]] + [language + [lux + ["[0]" generation] + ["[0]" declaration (.only Handler Bundle)] + ["[0]" analysis (.only Analysis) + ["[0]A" type] + ["[0]A" scope]] + ["[0]" synthesis (.only Synthesis) + ["<[1]>" \\parser]] + [phase + [generation + [jvm + ["[0]" runtime (.only Anchor Definition Extender)] + ["[0]" value]]] + ["[0]" extension (.only) + ["[0]" bundle] + [analysis + ["[0]" jvm]] + [generation + [jvm + ["[0]" host]]] + [declaration + ["/" lux]]]]]]]] + [type + ["[0]" check (.only Check)]]]]) + +(type Operation + (declaration.Operation Anchor (Bytecode Any) Definition)) + +(def signature (|>> type.signature signature.signature)) +(def reflection (|>> type.reflection reflection.reflection)) + +(type Declaration + [Text (List (Type Var))]) + +(def declaration + (Parser Declaration) + (.form (<>.and .text (<>.some jvm.var)))) + +(def method_privacy + (-> ffi.Privacy (Modifier method.Method)) + (|>> (pipe.case + {ffi.#PublicP} method.public + {ffi.#PrivateP} method.private + {ffi.#ProtectedP} method.protected + {ffi.#DefaultP} modifier.empty))) + +(def visibility' + (.Parser (Modifier field.Field)) + (`` (all <>.either + (~~ (with_template [