aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2021-08-21 04:06:54 -0400
committerEduardo Julian2021-08-21 04:06:54 -0400
commit1ea83ecadccc5adee1bdb35bd11527c3982c015e (patch)
treeb2a701e6eb14469d55a4f88af3f398a7d7056121 /stdlib/source
parent374ccf07246484eb7beb2cd87f3fc88396373ee1 (diff)
Can now produce arbitrary code fragments statically by evaluating arbitrary expressions at compile-time.
Diffstat (limited to '')
-rw-r--r--stdlib/source/documentation/lux.lux19
-rw-r--r--stdlib/source/documentation/lux/data/text.lux169
-rw-r--r--stdlib/source/documentation/lux/locale.lux33
-rw-r--r--stdlib/source/documentation/lux/locale/language.lux660
-rw-r--r--stdlib/source/documentation/lux/locale/territory.lux321
-rw-r--r--stdlib/source/documentation/lux/macro.lux87
-rw-r--r--stdlib/source/documentation/lux/macro/code.lux44
-rw-r--r--stdlib/source/documentation/lux/macro/local.lux28
-rw-r--r--stdlib/source/documentation/lux/macro/syntax.lux51
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/annotations.lux25
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/check.lux24
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/declaration.lux30
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/definition.lux33
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/export.lux23
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/input.lux27
-rw-r--r--stdlib/source/documentation/lux/macro/syntax/type/variable.lux27
-rw-r--r--stdlib/source/documentation/lux/macro/template.lux77
-rw-r--r--stdlib/source/documentation/lux/math.lux28
-rw-r--r--stdlib/source/documentation/lux/math/infix.lux31
-rw-r--r--stdlib/source/documentation/lux/math/logic.lux22
-rw-r--r--stdlib/source/documentation/lux/math/logic/continuous.lux32
-rw-r--r--stdlib/source/documentation/lux/math/logic/fuzzy.lux68
-rw-r--r--stdlib/source/library/lux.lux2
-rw-r--r--stdlib/source/library/lux/data/text.lux8
-rw-r--r--stdlib/source/library/lux/documentation.lux20
-rw-r--r--stdlib/source/library/lux/locale.lux2
-rw-r--r--stdlib/source/library/lux/locale/language.lux2
-rw-r--r--stdlib/source/library/lux/locale/territory.lux2
-rw-r--r--stdlib/source/library/lux/macro.lux26
-rw-r--r--stdlib/source/library/lux/macro/code.lux7
-rw-r--r--stdlib/source/library/lux/macro/local.lux4
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux16
-rw-r--r--stdlib/source/library/lux/macro/syntax/annotations.lux1
-rw-r--r--stdlib/source/library/lux/macro/syntax/check.lux1
-rw-r--r--stdlib/source/library/lux/macro/syntax/declaration.lux5
-rw-r--r--stdlib/source/library/lux/macro/syntax/definition.lux3
-rw-r--r--stdlib/source/library/lux/macro/syntax/export.lux1
-rw-r--r--stdlib/source/library/lux/macro/syntax/input.lux2
-rw-r--r--stdlib/source/library/lux/macro/syntax/type/variable.lux2
-rw-r--r--stdlib/source/library/lux/macro/template.lux55
-rw-r--r--stdlib/source/library/lux/math/infix.lux13
-rw-r--r--stdlib/source/library/lux/math/logic/continuous.lux3
-rw-r--r--stdlib/source/library/lux/math/logic/fuzzy.lux2
-rw-r--r--stdlib/source/library/lux/static.lux71
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux11
-rw-r--r--stdlib/source/test/lux.lux2
-rw-r--r--stdlib/source/test/lux/documentation.lux36
-rw-r--r--stdlib/source/test/lux/static.lux76
48 files changed, 2048 insertions, 184 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 2376510b5..4a964e552 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -15,9 +15,8 @@
["#." debug]
["#." documentation]
["#." ffi]
- ... ["#." locale]
- ... ["#." macro
- ... ["#/." code]]
+ ["#." locale]
+ ["#." macro]
... ["#." math]
... ["#." meta]
["#." program]
@@ -32,27 +31,19 @@
... <target>]
])
-(documentation: /.:of
- "Generates the type corresponding to a given expression."
- [(let [my_num +123]
- (:of my_num))
- "=>"
- .Int]
- [(:of +123)
- "=>"
- .Int])
-
(.def: .public documentation
(.List $.Module)
($.module /._
""
- [..:of]
+ []
[/abstract.documentation
/control.documentation
/data.documentation
/debug.documentation
/documentation.documentation
/ffi.documentation
+ /locale.documentation
+ /macro.documentation
/program.documentation]))
diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux
index 51c28a5ef..7887d97f6 100644
--- a/stdlib/source/documentation/lux/data/text.lux
+++ b/stdlib/source/documentation/lux/data/text.lux
@@ -1,9 +1,9 @@
(.module:
[library
- [lux #*
+ [lux (#- char)
["$" documentation (#+ documentation:)]
[data
- [text (#+ \n)
+ [text
["%" format (#+ format)]]
[collection
["." list]]]]]
@@ -13,15 +13,162 @@
["#." escape]
["#." format]
["#." regex]
- ["#." unicode]])
+ ["#." unicode]]
+ [\\library
+ ["." /]])
+
+(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'
+ ""
+ [(index' 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'
+ "Clips the remaining text from the input at the specified offset."
+ [(clip' 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/1
+ ""
+ [(replaced/1 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)
- (list.together
- (list /buffer.documentation
- /encoding.documentation
- /escape.documentation
- /format.documentation
- /regex.documentation
- /unicode.documentation
- )))
+ ($.module /._
+ ""
+ [..Char
+ ..line_feed
+ ..char
+ ..index'
+ ..index
+ ..last_index
+ ..starts_with?
+ ..ends_with?
+ ..enclosed_by?
+ ..contains?
+ ..prefix
+ ..suffix
+ ..enclosed
+ ..enclosed'
+ ..clip
+ ..clip'
+ ..split_at
+ ..split_by
+ ..all_split_by
+ ..replaced/1
+ ..replaced
+ ..interposed
+ ..space?
+ ($.default /.of_char)
+
+ ($.default /.\0)
+ ($.default /.null)
+ ($.default /.\a)
+ ($.default /.alarm)
+ ($.default /.\b)
+ ($.default /.back_space)
+ ($.default /.\t)
+ ($.default /.tab)
+ ($.default /.\n)
+ ($.default /.new_line)
+ ($.default /.\v)
+ ($.default /.vertical_tab)
+ ($.default /.\f)
+ ($.default /.form_feed)
+ ($.default /.\r)
+ ($.default /.carriage_return)
+ ($.default /.\'')
+ ($.default /.double_quote)
+
+ ($.default /.size)
+ ($.default /.format)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.monoid)
+ ($.default /.hash)
+ ($.default /.together)
+ ($.default /.empty?)
+ ($.default /.space)
+ ($.default /.lower_cased)
+ ($.default /.upper_cased)]
+ [/buffer.documentation
+ /encoding.documentation
+ /escape.documentation
+ /format.documentation
+ /regex.documentation
+ /unicode.documentation]))
diff --git a/stdlib/source/documentation/lux/locale.lux b/stdlib/source/documentation/lux/locale.lux
new file mode 100644
index 000000000..f299d2a96
--- /dev/null
+++ b/stdlib/source/documentation/lux/locale.lux
@@ -0,0 +1,33 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." language]
+ ["#." territory]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Locale
+ "A description of a locale; with territory, (optional) language, and (optional) text-encoding.")
+
+(documentation: /.locale
+ ""
+ [(locale language territory encoding)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Locale
+ ..locale
+ ($.default /.code)
+ ($.default /.hash)
+ ($.default /.equivalence)]
+ [/language.documentation
+ /territory.documentation]))
diff --git a/stdlib/source/documentation/lux/locale/language.lux b/stdlib/source/documentation/lux/locale/language.lux
new file mode 100644
index 000000000..fc720ddb1
--- /dev/null
+++ b/stdlib/source/documentation/lux/locale/language.lux
@@ -0,0 +1,660 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list ("#\." monoid)]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Language
+ "An ISO 639 language.")
+
+(def: items/~
+ (list.together
+ (list ($.default /.uncoded)
+ ($.default /.multiple)
+ ($.default /.undetermined)
+ ($.default /.not_applicable))))
+
+(def: items/a
+ (list.together
+ (list ($.default /.afar)
+ ($.default /.abkhazian)
+ ($.default /.achinese)
+ ($.default /.acoli)
+ ($.default /.adangme)
+ ($.default /.adyghe)
+ ($.default /.afro_asiatic)
+ ($.default /.afrihili)
+ ($.default /.afrikaans)
+ ($.default /.ainu)
+ ($.default /.akan)
+ ($.default /.akkadian)
+ ($.default /.aleut)
+ ($.default /.algonquian)
+ ($.default /.southern_altai)
+ ($.default /.amharic)
+ ($.default /.old_english)
+ ($.default /.angika)
+ ($.default /.apache)
+ ($.default /.arabic)
+ ($.default /.official_aramaic)
+ ($.default /.imperial_aramaic)
+ ($.default /.aragonese)
+ ($.default /.mapudungun)
+ ($.default /.arapaho)
+ ($.default /.artificial)
+ ($.default /.arawak)
+ ($.default /.assamese)
+ ($.default /.asturian)
+ ($.default /.bable)
+ ($.default /.leonese)
+ ($.default /.asturleonese)
+ ($.default /.athapascan)
+ ($.default /.australian)
+ ($.default /.avaric)
+ ($.default /.avestan)
+ ($.default /.awadhi)
+ ($.default /.aymara)
+ ($.default /.azerbaijani))))
+
+(def: items/b
+ (list.together
+ (list ($.default /.banda)
+ ($.default /.bamileke)
+ ($.default /.bashkir)
+ ($.default /.baluchi)
+ ($.default /.bambara)
+ ($.default /.balinese)
+ ($.default /.basa)
+ ($.default /.baltic)
+ ($.default /.beja)
+ ($.default /.belarusian)
+ ($.default /.bemba)
+ ($.default /.bengali)
+ ($.default /.berber)
+ ($.default /.bhojpuri)
+ ($.default /.bihari)
+ ($.default /.bikol)
+ ($.default /.bini)
+ ($.default /.edo)
+ ($.default /.bislama)
+ ($.default /.siksika)
+ ($.default /.bantu)
+ ($.default /.tibetan)
+ ($.default /.bosnian)
+ ($.default /.braj)
+ ($.default /.breton)
+ ($.default /.batak)
+ ($.default /.buriat)
+ ($.default /.buginese)
+ ($.default /.bulgarian)
+ ($.default /.blin)
+ ($.default /.bilin))))
+
+(def: items/c
+ (list.together
+ (list ($.default /.caddo)
+ ($.default /.central_american_indian)
+ ($.default /.galibi_carib)
+ ($.default /.catalan)
+ ($.default /.valencian)
+ ($.default /.caucasian)
+ ($.default /.cebuano)
+ ($.default /.celtic)
+ ($.default /.czech)
+ ($.default /.chamorro)
+ ($.default /.chibcha)
+ ($.default /.chechen)
+ ($.default /.chagatai)
+ ($.default /.chuukese)
+ ($.default /.mari)
+ ($.default /.chinook)
+ ($.default /.choctaw)
+ ($.default /.chipewyan)
+ ($.default /.cherokee)
+ ($.default /.church_slavic)
+ ($.default /.old_slavonic)
+ ($.default /.church_slavonic)
+ ($.default /.old_bulgarian)
+ ($.default /.old_church_slavonic)
+ ($.default /.chuvash)
+ ($.default /.cheyenne)
+ ($.default /.chamic)
+ ($.default /.montenegrin)
+ ($.default /.coptic)
+ ($.default /.cornish)
+ ($.default /.corsican)
+ ($.default /.creoles_and_pidgins/english)
+ ($.default /.creoles_and_pidgins/french)
+ ($.default /.creoles_and_pidgins/portuguese)
+ ($.default /.cree)
+ ($.default /.crimean)
+ ($.default /.creoles_and_pidgins)
+ ($.default /.kashubian)
+ ($.default /.cushitic)
+ ($.default /.welsh))))
+
+(def: items/d
+ (list.together
+ (list ($.default /.dakota)
+ ($.default /.danish)
+ ($.default /.dargwa)
+ ($.default /.land_dayak)
+ ($.default /.delaware)
+ ($.default /.slavey)
+ ($.default /.german)
+ ($.default /.dogrib)
+ ($.default /.dinka)
+ ($.default /.dhivehi)
+ ($.default /.maldivian)
+ ($.default /.dogri)
+ ($.default /.dravidian)
+ ($.default /.lower_sorbian)
+ ($.default /.duala)
+ ($.default /.middle_dutch)
+ ($.default /.dyula)
+ ($.default /.dzongkha))))
+
+(def: items/e
+ (list.together
+ (list ($.default /.efik)
+ ($.default /.egyptian)
+ ($.default /.ekajuk)
+ ($.default /.greek)
+ ($.default /.elamite)
+ ($.default /.english)
+ ($.default /.middle_english)
+ ($.default /.esperanto)
+ ($.default /.estonian)
+ ($.default /.basque)
+ ($.default /.ewe)
+ ($.default /.ewondo))))
+
+(def: items/f
+ (list.together
+ (list ($.default /.fang)
+ ($.default /.faroese)
+ ($.default /.persian)
+ ($.default /.fanti)
+ ($.default /.fijian)
+ ($.default /.filipino)
+ ($.default /.finnish)
+ ($.default /.finno_ugrian)
+ ($.default /.fon)
+ ($.default /.french)
+ ($.default /.middle_french)
+ ($.default /.old_french)
+ ($.default /.northern_frisian)
+ ($.default /.eastern_frisian)
+ ($.default /.western_frisian)
+ ($.default /.fulah)
+ ($.default /.friulian))))
+
+(def: items/g
+ (list.together
+ (list ($.default /.ga)
+ ($.default /.gayo)
+ ($.default /.gbaya)
+ ($.default /.germanic)
+ ($.default /.geez)
+ ($.default /.gilbertese)
+ ($.default /.gaelic)
+ ($.default /.irish)
+ ($.default /.galician)
+ ($.default /.manx)
+ ($.default /.middle_high_german)
+ ($.default /.old_high_german)
+ ($.default /.gondi)
+ ($.default /.gorontalo)
+ ($.default /.gothic)
+ ($.default /.grebo)
+ ($.default /.ancient_greek)
+ ($.default /.guarani)
+ ($.default /.swiss_german)
+ ($.default /.alemannic)
+ ($.default /.alsatian)
+ ($.default /.gujarati)
+ ($.default /.gwich'in))))
+
+(def: items/h
+ (list.together
+ (list ($.default /.haida)
+ ($.default /.haitian)
+ ($.default /.hausa)
+ ($.default /.hawaiian)
+ ($.default /.hebrew)
+ ($.default /.herero)
+ ($.default /.hiligaynon)
+ ($.default /.himachali)
+ ($.default /.hindi)
+ ($.default /.hittite)
+ ($.default /.hmong)
+ ($.default /.hiri_motu)
+ ($.default /.croatian)
+ ($.default /.upper_sorbian)
+ ($.default /.hungarian)
+ ($.default /.hupa)
+ ($.default /.armenian))))
+
+(def: items/i
+ (list.together
+ (list ($.default /.iban)
+ ($.default /.igbo)
+ ($.default /.ido)
+ ($.default /.sichuan_yi)
+ ($.default /.nuosu)
+ ($.default /.ijo)
+ ($.default /.inuktitut)
+ ($.default /.interlingue)
+ ($.default /.iloko)
+ ($.default /.interlingua)
+ ($.default /.indic)
+ ($.default /.indonesian)
+ ($.default /.indo_european)
+ ($.default /.ingush)
+ ($.default /.inupiaq)
+ ($.default /.iranian)
+ ($.default /.iroquoian)
+ ($.default /.icelandic)
+ ($.default /.italian))))
+
+(def: items/j
+ (list.together
+ (list ($.default /.javanese)
+ ($.default /.lojban)
+ ($.default /.japanese)
+ ($.default /.judeo_persian)
+ ($.default /.judeo_arabic))))
+
+(def: items/k
+ (list.together
+ (list ($.default /.kara_kalpak)
+ ($.default /.kabyle)
+ ($.default /.kachin)
+ ($.default /.jingpho)
+ ($.default /.kalaallisut)
+ ($.default /.greenlandic)
+ ($.default /.kamba)
+ ($.default /.kannada)
+ ($.default /.karen)
+ ($.default /.kashmiri)
+ ($.default /.georgian)
+ ($.default /.kanuri)
+ ($.default /.kawi)
+ ($.default /.kazakh)
+ ($.default /.kabardian)
+ ($.default /.khasi)
+ ($.default /.khoisan)
+ ($.default /.central_khmer)
+ ($.default /.khotanese)
+ ($.default /.sakan)
+ ($.default /.gikuyu)
+ ($.default /.kinyarwanda)
+ ($.default /.kyrgyz)
+ ($.default /.kimbundu)
+ ($.default /.konkani)
+ ($.default /.komi)
+ ($.default /.kongo)
+ ($.default /.korean)
+ ($.default /.kosraean)
+ ($.default /.kpelle)
+ ($.default /.karachay_balkar)
+ ($.default /.karelian)
+ ($.default /.kru)
+ ($.default /.kurukh)
+ ($.default /.kwanyama)
+ ($.default /.kumyk)
+ ($.default /.kurdish)
+ ($.default /.kutenai))))
+
+(def: items/l
+ (list.together
+ (list ($.default /.ladino)
+ ($.default /.lahnda)
+ ($.default /.lamba)
+ ($.default /.lao)
+ ($.default /.latin)
+ ($.default /.latvian)
+ ($.default /.lezghian)
+ ($.default /.limburgan)
+ ($.default /.lingala)
+ ($.default /.lithuanian)
+ ($.default /.mongo)
+ ($.default /.lozi)
+ ($.default /.luxembourgish)
+ ($.default /.luba_lulua)
+ ($.default /.luba_katanga)
+ ($.default /.ganda)
+ ($.default /.luiseno)
+ ($.default /.lunda)
+ ($.default /.luo)
+ ($.default /.lushai))))
+
+(def: items/m
+ (list.together
+ (list ($.default /.madurese)
+ ($.default /.magahi)
+ ($.default /.marshallese)
+ ($.default /.maithili)
+ ($.default /.makasar)
+ ($.default /.malayalam)
+ ($.default /.mandingo)
+ ($.default /.austronesian)
+ ($.default /.marathi)
+ ($.default /.masai)
+ ($.default /.moksha)
+ ($.default /.mandar)
+ ($.default /.mende)
+ ($.default /.middle_irish)
+ ($.default /.mi'kmaq)
+ ($.default /.micmac)
+ ($.default /.minangkabau)
+ ($.default /.macedonian)
+ ($.default /.mon_khmer)
+ ($.default /.malagasy)
+ ($.default /.maltese)
+ ($.default /.manchu)
+ ($.default /.manipuri)
+ ($.default /.manobo)
+ ($.default /.mohawk)
+ ($.default /.mongolian)
+ ($.default /.mossi)
+ ($.default /.maori)
+ ($.default /.malay)
+ ($.default /.munda)
+ ($.default /.creek)
+ ($.default /.mirandese)
+ ($.default /.marwari)
+ ($.default /.burmese)
+ ($.default /.mayan)
+ ($.default /.erzya))))
+
+(def: items/n
+ (list.together
+ (list ($.default /.nahuatl)
+ ($.default /.north_american_indian)
+ ($.default /.neapolitan)
+ ($.default /.nauru)
+ ($.default /.navajo)
+ ($.default /.south_ndebele)
+ ($.default /.north_ndebele)
+ ($.default /.ndonga)
+ ($.default /.low_german)
+ ($.default /.nepali)
+ ($.default /.newari)
+ ($.default /.nepal_bhasa)
+ ($.default /.nias)
+ ($.default /.niger_kordofanian)
+ ($.default /.niuean)
+ ($.default /.dutch)
+ ($.default /.flemish)
+ ($.default /.nynorsk)
+ ($.default /.bokmal)
+ ($.default /.nogai)
+ ($.default /.old_norse)
+ ($.default /.norwegian)
+ ($.default /.n'ko)
+ ($.default /.northern_sotho)
+ ($.default /.pedi)
+ ($.default /.sepedi)
+ ($.default /.nubian)
+ ($.default /.old_newari)
+ ($.default /.classical_newari)
+ ($.default /.classical_nepal_bhasa)
+ ($.default /.nyanja)
+ ($.default /.chichewa)
+ ($.default /.chewa)
+ ($.default /.nyamwezi)
+ ($.default /.nyankole)
+ ($.default /.nyoro)
+ ($.default /.nzima))))
+
+(def: items/o
+ (list.together
+ (list ($.default /.occitan)
+ ($.default /.provencal)
+ ($.default /.ojibwa)
+ ($.default /.oriya)
+ ($.default /.oromo)
+ ($.default /.osage)
+ ($.default /.ossetic)
+ ($.default /.ottoman_turkish)
+ ($.default /.otomian))))
+
+(def: items/p
+ (list.together
+ (list ($.default /.papuan)
+ ($.default /.pangasinan)
+ ($.default /.pahlavi)
+ ($.default /.pampanga)
+ ($.default /.kapampangan)
+ ($.default /.punjabi)
+ ($.default /.papiamento)
+ ($.default /.palauan)
+ ($.default /.old_persian)
+ ($.default /.philippine)
+ ($.default /.phoenician)
+ ($.default /.pali)
+ ($.default /.polish)
+ ($.default /.pohnpeian)
+ ($.default /.portuguese)
+ ($.default /.prakrit)
+ ($.default /.old_provencal)
+ ($.default /.pashto))))
+
+(def: items/q
+ (list.together
+ (list ($.default /.quechua))))
+
+(def: items/r
+ (list.together
+ (list ($.default /.rajasthani)
+ ($.default /.rapanui)
+ ($.default /.rarotongan)
+ ($.default /.cook_islands_maori)
+ ($.default /.romance)
+ ($.default /.romansh)
+ ($.default /.romany)
+ ($.default /.romanian)
+ ($.default /.moldavian)
+ ($.default /.moldovan)
+ ($.default /.rundi)
+ ($.default /.aromanian)
+ ($.default /.arumanian)
+ ($.default /.macedo_romanian)
+ ($.default /.russian))))
+
+(def: items/s
+ (list.together
+ (list ($.default /.sandawe)
+ ($.default /.sango)
+ ($.default /.yakut)
+ ($.default /.south_american_indian)
+ ($.default /.salishan)
+ ($.default /.samaritan_aramaic)
+ ($.default /.sanskrit)
+ ($.default /.sasak)
+ ($.default /.santali)
+ ($.default /.sicilian)
+ ($.default /.scots)
+ ($.default /.selkup)
+ ($.default /.semitic)
+ ($.default /.old_irish)
+ ($.default /.sign)
+ ($.default /.shan)
+ ($.default /.sidamo)
+ ($.default /.sinhalese)
+ ($.default /.siouan)
+ ($.default /.sino_tibetan)
+ ($.default /.slavic)
+ ($.default /.slovak)
+ ($.default /.slovenian)
+ ($.default /.southern_sami)
+ ($.default /.northern_sami)
+ ($.default /.sami)
+ ($.default /.lule)
+ ($.default /.inari)
+ ($.default /.samoan)
+ ($.default /.skolt_sami)
+ ($.default /.shona)
+ ($.default /.sindhi)
+ ($.default /.soninke)
+ ($.default /.sogdian)
+ ($.default /.somali)
+ ($.default /.songhai)
+ ($.default /.southern_sotho)
+ ($.default /.spanish)
+ ($.default /.castilian)
+ ($.default /.albanian)
+ ($.default /.sardinian)
+ ($.default /.sranan_tongo)
+ ($.default /.serbian)
+ ($.default /.serer)
+ ($.default /.nilo_saharan)
+ ($.default /.swati)
+ ($.default /.sukuma)
+ ($.default /.sundanese)
+ ($.default /.susu)
+ ($.default /.sumerian)
+ ($.default /.swahili)
+ ($.default /.swedish)
+ ($.default /.classical_syriac)
+ ($.default /.syriac))))
+
+(def: items/t
+ (list.together
+ (list ($.default /.tahitian)
+ ($.default /.tai)
+ ($.default /.tamil)
+ ($.default /.tatar)
+ ($.default /.telugu)
+ ($.default /.timne)
+ ($.default /.tereno)
+ ($.default /.tetum)
+ ($.default /.tajik)
+ ($.default /.tagalog)
+ ($.default /.thai)
+ ($.default /.tigre)
+ ($.default /.tigrinya)
+ ($.default /.tiv)
+ ($.default /.tokelau)
+ ($.default /.klingon)
+ ($.default /.tlingit)
+ ($.default /.tamashek)
+ ($.default /.tonga)
+ ($.default /.tongan)
+ ($.default /.tok_pisin)
+ ($.default /.tsimshian)
+ ($.default /.tswana)
+ ($.default /.tsonga)
+ ($.default /.turkmen)
+ ($.default /.tumbuka)
+ ($.default /.tupi)
+ ($.default /.turkish)
+ ($.default /.altaic)
+ ($.default /.tuvalu)
+ ($.default /.twi)
+ ($.default /.tuvinian))))
+
+(def: items/u
+ (list.together
+ (list ($.default /.udmurt)
+ ($.default /.ugaritic)
+ ($.default /.uyghur)
+ ($.default /.ukrainian)
+ ($.default /.umbundu)
+ ($.default /.urdu)
+ ($.default /.uzbek))))
+
+(def: items/v
+ (list.together
+ (list ($.default /.vai)
+ ($.default /.venda)
+ ($.default /.vietnamese)
+ ($.default /.volapük)
+ ($.default /.votic))))
+
+(def: items/w
+ (list.together
+ (list ($.default /.wakashan)
+ ($.default /.walamo)
+ ($.default /.waray)
+ ($.default /.washo)
+ ($.default /.sorbian)
+ ($.default /.walloon)
+ ($.default /.wolof))))
+
+(def: items/x
+ (list.together
+ (list ($.default /.kalmyk)
+ ($.default /.oirat)
+ ($.default /.xhosa))))
+
+(def: items/y
+ (list.together
+ (list ($.default /.yao)
+ ($.default /.yapese)
+ ($.default /.yiddish)
+ ($.default /.yoruba)
+ ($.default /.yupik))))
+
+(def: items/z
+ (list.together
+ (list ($.default /.zapotec)
+ ($.default /.blissymbols)
+ ($.default /.zenaga)
+ ($.default /.standard_moroccan_tamazight)
+ ($.default /.zhuang)
+ ($.default /.chinese)
+ ($.default /.zande)
+ ($.default /.zulu)
+ ($.default /.zuni)
+ ($.default /.zaza)
+ ($.default /.dimili)
+ ($.default /.dimli)
+ ($.default /.kirdki)
+ ($.default /.kirmanjki)
+ ($.default /.zazaki))))
+
+(.def: .public documentation
+ (.List $.Module)
+ (`` ($.module /._
+ ""
+ [..Language
+ ($.default /.name)
+ ($.default /.code)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ..items/~
+ ..items/a
+ ..items/b
+ ..items/c
+ ..items/d
+ ..items/e
+ ..items/f
+ ..items/g
+ ..items/h
+ ..items/i
+ ..items/j
+ ..items/k
+ ..items/l
+ ..items/m
+ ..items/n
+ ..items/o
+ ..items/p
+ ..items/q
+ ..items/r
+ ..items/s
+ ..items/t
+ ..items/u
+ ..items/v
+ ..items/w
+ ..items/x
+ ..items/y
+ ..items/z]
+ [])))
diff --git a/stdlib/source/documentation/lux/locale/territory.lux b/stdlib/source/documentation/lux/locale/territory.lux
new file mode 100644
index 000000000..eb4553615
--- /dev/null
+++ b/stdlib/source/documentation/lux/locale/territory.lux
@@ -0,0 +1,321 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list ("#\." monoid)]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Territory
+ "An ISO 3166 territory.")
+
+(def: items/ab
+ (list.together
+ (list ($.default /.afghanistan)
+ ($.default /.aland_islands)
+ ($.default /.albania)
+ ($.default /.algeria)
+ ($.default /.american_samoa)
+ ($.default /.andorra)
+ ($.default /.angola)
+ ($.default /.anguilla)
+ ($.default /.antarctica)
+ ($.default /.antigua)
+ ($.default /.barbuda)
+ ($.default /.argentina)
+ ($.default /.armenia)
+ ($.default /.aruba)
+ ($.default /.australia)
+ ($.default /.austria)
+ ($.default /.azerbaijan)
+ ($.default /.the_bahamas)
+ ($.default /.bahrain)
+ ($.default /.bangladesh)
+ ($.default /.barbados)
+ ($.default /.belarus)
+ ($.default /.belgium)
+ ($.default /.belize)
+ ($.default /.benin)
+ ($.default /.bermuda)
+ ($.default /.bhutan)
+ ($.default /.bolivia)
+ ($.default /.bonaire)
+ ($.default /.sint_eustatius)
+ ($.default /.saba)
+ ($.default /.bosnia)
+ ($.default /.herzegovina)
+ ($.default /.botswana)
+ ($.default /.bouvet_island)
+ ($.default /.brazil)
+ ($.default /.british_indian_ocean_territory)
+ ($.default /.brunei_darussalam)
+ ($.default /.bulgaria)
+ ($.default /.burkina_faso)
+ ($.default /.burundi))))
+
+(def: items/cd
+ (list.together
+ (list ($.default /.cape_verde)
+ ($.default /.cambodia)
+ ($.default /.cameroon)
+ ($.default /.canada)
+ ($.default /.cayman_islands)
+ ($.default /.central_african_republic)
+ ($.default /.chad)
+ ($.default /.chile)
+ ($.default /.china)
+ ($.default /.christmas_island)
+ ($.default /.cocos_islands)
+ ($.default /.colombia)
+ ($.default /.comoros)
+ ($.default /.congo)
+ ($.default /.democratic_republic_of_the_congo)
+ ($.default /.cook_islands)
+ ($.default /.costa_rica)
+ ($.default /.ivory_coast)
+ ($.default /.croatia)
+ ($.default /.cuba)
+ ($.default /.curacao)
+ ($.default /.cyprus)
+ ($.default /.czech_republic)
+ ($.default /.denmark)
+ ($.default /.djibouti)
+ ($.default /.dominica)
+ ($.default /.dominican_republic))))
+
+(def: items/efg
+ (list.together
+ (list ($.default /.ecuador)
+ ($.default /.egypt)
+ ($.default /.el_salvador)
+ ($.default /.equatorial_guinea)
+ ($.default /.eritrea)
+ ($.default /.estonia)
+ ($.default /.eswatini)
+ ($.default /.ethiopia)
+ ($.default /.falkland_islands)
+ ($.default /.faroe_islands)
+ ($.default /.fiji)
+ ($.default /.finland)
+ ($.default /.france)
+ ($.default /.french_guiana)
+ ($.default /.french_polynesia)
+ ($.default /.french_southern_territories)
+ ($.default /.gabon)
+ ($.default /.the_gambia)
+ ($.default /.georgia)
+ ($.default /.germany)
+ ($.default /.ghana)
+ ($.default /.gibraltar)
+ ($.default /.greece)
+ ($.default /.greenland)
+ ($.default /.grenada)
+ ($.default /.guadeloupe)
+ ($.default /.guam)
+ ($.default /.guatemala)
+ ($.default /.guernsey)
+ ($.default /.guinea)
+ ($.default /.guinea_bissau)
+ ($.default /.guyana))))
+
+(def: items/hijkl
+ (list.together
+ (list ($.default /.haiti)
+ ($.default /.heard_island)
+ ($.default /.mcdonald_islands)
+ ($.default /.vatican_city)
+ ($.default /.honduras)
+ ($.default /.hong_kong)
+ ($.default /.hungary)
+ ($.default /.iceland)
+ ($.default /.india)
+ ($.default /.indonesia)
+ ($.default /.iran)
+ ($.default /.iraq)
+ ($.default /.ireland)
+ ($.default /.isle_of_man)
+ ($.default /.israel)
+ ($.default /.italy)
+ ($.default /.jamaica)
+ ($.default /.japan)
+ ($.default /.jersey)
+ ($.default /.jordan)
+ ($.default /.kazakhstan)
+ ($.default /.kenya)
+ ($.default /.kiribati)
+ ($.default /.north_korea)
+ ($.default /.south_korea)
+ ($.default /.kuwait)
+ ($.default /.kyrgyzstan)
+ ($.default /.laos)
+ ($.default /.latvia)
+ ($.default /.lebanon)
+ ($.default /.lesotho)
+ ($.default /.liberia)
+ ($.default /.libya)
+ ($.default /.liechtenstein)
+ ($.default /.lithuania)
+ ($.default /.luxembourg))))
+
+(def: items/mno
+ (list.together
+ (list ($.default /.macau)
+ ($.default /.macedonia)
+ ($.default /.madagascar)
+ ($.default /.malawi)
+ ($.default /.malaysia)
+ ($.default /.maldives)
+ ($.default /.mali)
+ ($.default /.malta)
+ ($.default /.marshall_islands)
+ ($.default /.martinique)
+ ($.default /.mauritania)
+ ($.default /.mauritius)
+ ($.default /.mayotte)
+ ($.default /.mexico)
+ ($.default /.micronesia)
+ ($.default /.moldova)
+ ($.default /.monaco)
+ ($.default /.mongolia)
+ ($.default /.montenegro)
+ ($.default /.montserrat)
+ ($.default /.morocco)
+ ($.default /.mozambique)
+ ($.default /.myanmar)
+ ($.default /.namibia)
+ ($.default /.nauru)
+ ($.default /.nepal)
+ ($.default /.netherlands)
+ ($.default /.new_caledonia)
+ ($.default /.new_zealand)
+ ($.default /.nicaragua)
+ ($.default /.niger)
+ ($.default /.nigeria)
+ ($.default /.niue)
+ ($.default /.norfolk_island)
+ ($.default /.northern_mariana_islands)
+ ($.default /.norway)
+ ($.default /.oman))))
+
+(def: items/pqrs
+ (list.together
+ (list ($.default /.pakistan)
+ ($.default /.palau)
+ ($.default /.palestine)
+ ($.default /.panama)
+ ($.default /.papua_new_guinea)
+ ($.default /.paraguay)
+ ($.default /.peru)
+ ($.default /.philippines)
+ ($.default /.pitcairn_islands)
+ ($.default /.poland)
+ ($.default /.portugal)
+ ($.default /.puerto_rico)
+ ($.default /.qatar)
+ ($.default /.reunion)
+ ($.default /.romania)
+ ($.default /.russia)
+ ($.default /.rwanda)
+ ($.default /.saint_barthelemy)
+ ($.default /.saint_helena)
+ ($.default /.ascension)
+ ($.default /.tristan_da_cunha)
+ ($.default /.saint_kitts)
+ ($.default /.nevis)
+ ($.default /.saint_lucia)
+ ($.default /.saint_martin)
+ ($.default /.saint_pierre)
+ ($.default /.miquelon)
+ ($.default /.saint_vincent)
+ ($.default /.the_grenadines)
+ ($.default /.samoa)
+ ($.default /.san_marino)
+ ($.default /.sao_tome)
+ ($.default /.principe)
+ ($.default /.saudi_arabia)
+ ($.default /.senegal)
+ ($.default /.serbia)
+ ($.default /.seychelles)
+ ($.default /.sierra_leone)
+ ($.default /.singapore)
+ ($.default /.sint_maarten)
+ ($.default /.slovakia)
+ ($.default /.slovenia)
+ ($.default /.solomon_islands)
+ ($.default /.somalia)
+ ($.default /.south_africa)
+ ($.default /.south_georgia)
+ ($.default /.south_sandwich_islands)
+ ($.default /.south_sudan)
+ ($.default /.spain)
+ ($.default /.sri_lanka)
+ ($.default /.sudan)
+ ($.default /.suriname)
+ ($.default /.svalbard)
+ ($.default /.jan_mayen)
+ ($.default /.sweden)
+ ($.default /.switzerland)
+ ($.default /.syria))))
+
+(def: items/tuvwxyz
+ (list.together
+ (list ($.default /.taiwan)
+ ($.default /.tajikistan)
+ ($.default /.tanzania)
+ ($.default /.thailand)
+ ($.default /.east_timor)
+ ($.default /.togo)
+ ($.default /.tokelau)
+ ($.default /.tonga)
+ ($.default /.trinidad)
+ ($.default /.tobago)
+ ($.default /.tunisia)
+ ($.default /.turkey)
+ ($.default /.turkmenistan)
+ ($.default /.turks)
+ ($.default /.caicos_islands)
+ ($.default /.tuvalu)
+ ($.default /.uganda)
+ ($.default /.ukraine)
+ ($.default /.united_arab_emirates)
+ ($.default /.united_kingdom)
+ ($.default /.northern_ireland)
+ ($.default /.united_states_of_america)
+ ($.default /.united_states_minor_outlying_islands)
+ ($.default /.uruguay)
+ ($.default /.uzbekistan)
+ ($.default /.vanuatu)
+ ($.default /.venezuela)
+ ($.default /.vietnam)
+ ($.default /.british_virgin_islands)
+ ($.default /.united_states_virgin_islands)
+ ($.default /.wallis)
+ ($.default /.futuna)
+ ($.default /.western_sahara)
+ ($.default /.yemen)
+ ($.default /.zambia)
+ ($.default /.zimbabwe))))
+
+(.def: .public documentation
+ (.List $.Module)
+ (`` ($.module /._
+ ""
+ [..Territory
+ ($.default /.name)
+ ($.default /.short_code)
+ ($.default /.long_code)
+ ($.default /.numeric_code)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ..items/ab
+ ..items/cd
+ ..items/efg
+ ..items/hijkl
+ ..items/mno
+ ..items/pqrs
+ ..items/tuvwxyz]
+ [])))
diff --git a/stdlib/source/documentation/lux/macro.lux b/stdlib/source/documentation/lux/macro.lux
new file mode 100644
index 000000000..f222d778c
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro.lux
@@ -0,0 +1,87 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." code]
+ ["#." local]
+ ["#." syntax]
+ ["#." template]]
+ [\\library
+ ["." /]])
+
+(documentation: /.single_expansion
+ (format "Given code that requires applying a macro, does it once and returns the result."
+ \n "Otherwise, returns the code as-is.")
+ [(single_expansion syntax)])
+
+(documentation: /.expansion
+ (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
+ \n "Otherwise, returns the code as-is.")
+ [(expansion syntax)])
+
+(documentation: /.full_expansion
+ "Expands all macro-calls everywhere recursively, until only primitive/base code remains."
+ [(full_expansion syntax)])
+
+(documentation: /.identifier
+ (format "Generates a unique name as an Code node (ready to be used in code templates)."
+ \n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.")
+ [(identifier prefix)])
+
+(documentation: /.wrong_syntax_error
+ "A generic error message for macro syntax failures.")
+
+(documentation: /.with_identifiers
+ "Creates new identifiers and offers them to the body expression."
+ [(syntax: (synchronized [lock any
+ body any])
+ (with_identifiers [g!lock g!body g!_]
+ (in (list (` (let [(~ g!lock) (~ lock)
+ (~ g!_) ("jvm monitorenter" (~ g!lock))
+ (~ g!body) (~ body)
+ (~ g!_) ("jvm monitorexit" (~ g!lock))]
+ (~ g!body)))))))])
+
+(documentation: /.one_expansion
+ "Works just like expand, except that it ensures that the output is a single Code token."
+ [(one_expansion token)])
+
+(template [<macro>]
+ [(documentation: <macro>
+ (format "Performs a macro-expansion and logs the resulting code."
+ \n "You can either use the resulting code, or omit them."
+ \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
+ [(<macro> #omit
+ (def: (foo bar baz)
+ (-> Int Int Int)
+ (int.+ bar baz)))])]
+
+ [/.log_single_expansion!]
+ [/.log_expansion!]
+ [/.log_full_expansion!]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..single_expansion
+ ..expansion
+ ..full_expansion
+ ..identifier
+ ..wrong_syntax_error
+ ..with_identifiers
+ ..one_expansion
+ ..log_single_expansion!
+ ..log_expansion!
+ ..log_full_expansion!]
+ [/code.documentation
+ /local.documentation
+ /syntax.documentation
+ /template.documentation]))
diff --git a/stdlib/source/documentation/lux/macro/code.lux b/stdlib/source/documentation/lux/macro/code.lux
new file mode 100644
index 000000000..6102046b1
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/code.lux
@@ -0,0 +1,44 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.local_identifier
+ "Produces a local identifier (an identifier with no module prefix).")
+
+(documentation: /.local_tag
+ "Produces a local tag (a tag with no module prefix).")
+
+(documentation: /.replaced
+ ""
+ [(replaced original substitute ast)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..local_identifier
+ ..local_tag
+ ..replaced
+ ($.default /.bit)
+ ($.default /.nat)
+ ($.default /.int)
+ ($.default /.rev)
+ ($.default /.frac)
+ ($.default /.text)
+ ($.default /.identifier)
+ ($.default /.tag)
+ ($.default /.form)
+ ($.default /.tuple)
+ ($.default /.record)
+
+ ($.default /.equivalence)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/local.lux b/stdlib/source/documentation/lux/macro/local.lux
new file mode 100644
index 000000000..5b6acf1b5
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/local.lux
@@ -0,0 +1,28 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(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 "This code un-installs the macros."
+ \n "NOTE: Always use this code once to clean-up..")
+ [(push macros)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..push
+ ($.default /.unknown_module)
+ ($.default /.cannot_shadow_definition)
+ ($.default /.unknown_definition)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux
new file mode 100644
index 000000000..b0e76e1a8
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax.lux
@@ -0,0 +1,51 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." annotations]
+ ["#." check]
+ ["#." declaration]
+ ["#." definition]
+ ["#." export]
+ ["#." input]
+ ["#." type #_
+ ["#/." variable]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.syntax:
+ (format \n "A more advanced way to define macros than 'macro:'."
+ \n "The inputs to the macro can be parsed in complex ways through the use of syntax parsers."
+ \n "The macro body is also (implicitly) run in the Meta monad, to save some typing."
+ \n "Also, the compiler state can be accessed through the *lux* binding.")
+ [(syntax: .public (object [.let [imports (class_imports *lux*)]
+ .let [class_vars (list)]
+ super (opt (super_class_decl^ imports class_vars))
+ interfaces (tuple (some (super_class_decl^ imports class_vars)))
+ constructor_args (constructor_args^ imports class_vars)
+ methods (some (overriden_method_def^ imports))])
+ (let [def_code ($_ text\compose "anon-class:"
+ (spaced (list (super_class_decl$ (maybe.else object_super_class super))
+ (with_brackets (spaced (list\map super_class_decl$ interfaces)))
+ (with_brackets (spaced (list\map constructor_arg$ constructor_args)))
+ (with_brackets (spaced (list\map (method_def$ id) methods))))))]
+ (in (list (` ((~ (code.text def_code))))))))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..syntax:]
+ [/annotations.documentation
+ /check.documentation
+ /declaration.documentation
+ /definition.documentation
+ /export.documentation
+ /input.documentation
+ /type/variable.documentation]))
diff --git a/stdlib/source/documentation/lux/macro/syntax/annotations.lux b/stdlib/source/documentation/lux/macro/syntax/annotations.lux
new file mode 100644
index 000000000..2fbb28d35
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/annotations.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Annotations
+ "Definition/module annotations.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Annotations
+ ($.default /.equivalence)
+ ($.default /.empty)
+ ($.default /.format)
+ ($.default /.parser)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/check.lux b/stdlib/source/documentation/lux/macro/syntax/check.lux
new file mode 100644
index 000000000..0d0ffcdd3
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/check.lux
@@ -0,0 +1,24 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Check
+ "A type annotation for an expression.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Check
+ ($.default /.equivalence)
+ ($.default /.format)
+ ($.default /.parser)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/declaration.lux b/stdlib/source/documentation/lux/macro/syntax/declaration.lux
new file mode 100644
index 000000000..45611f4e6
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/declaration.lux
@@ -0,0 +1,30 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Declaration
+ "A declaration for either a constant or a function.")
+
+(documentation: /.parser
+ "A parser for declaration syntax."
+ ["Such as:"
+ quux
+ (foo bar baz)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Declaration
+ ..parser
+ ($.default /.equivalence)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/definition.lux b/stdlib/source/documentation/lux/macro/syntax/definition.lux
new file mode 100644
index 000000000..21befadc2
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/definition.lux
@@ -0,0 +1,33 @@
+(.module:
+ [library
+ [lux (#- Definition)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Definition
+ "Syntax for a constant definition.")
+
+(documentation: /.parser
+ "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition."
+ [(parser compiler)])
+
+(documentation: /.typed
+ "Only works for typed definitions."
+ [(typed compiler)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Definition
+ ..parser
+ ..typed
+ ($.default /.equivalence)
+ ($.default /.lacks_type)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/export.lux b/stdlib/source/documentation/lux/macro/syntax/export.lux
new file mode 100644
index 000000000..cadab752a
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/export.lux
@@ -0,0 +1,23 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.parser
+ ""
+ [(parser un_exported)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Syntax for marking a definition as an export."
+ [..parser
+ ($.default /.default_policy)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/input.lux b/stdlib/source/documentation/lux/macro/syntax/input.lux
new file mode 100644
index 000000000..bd1a5daa5
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/input.lux
@@ -0,0 +1,27 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Input
+ "The common typed-argument syntax used by many macros.")
+
+(documentation: /.parser
+ "Parser for the common typed-argument syntax used by many macros.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Input
+ ..parser
+ ($.default /.equivalence)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux
new file mode 100644
index 000000000..d46d85588
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux
@@ -0,0 +1,27 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Variable
+ "A variable'S name.")
+
+(documentation: /.parser
+ "Parser for the common type variable/parameter used by many macros.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Variable
+ ..parser
+ ($.default /.equivalence)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux
new file mode 100644
index 000000000..894d68c3d
--- /dev/null
+++ b/stdlib/source/documentation/lux/macro/template.lux
@@ -0,0 +1,77 @@
+(.module:
+ [library
+ [lux (#- let)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.spliced
+ ""
+ [(spliced [a b c d])
+ "=>"
+ a
+ b
+ c
+ d])
+
+(documentation: /.amount
+ ""
+ [(amount [a b c d])
+ "=>"
+ 4])
+
+(documentation: /.with_locals
+ "Creates names for local bindings aliased by the names you choose."
+ [(with_locals [my_var]
+ (let [my_var 123]
+ (text [my_var])))
+ "=>"
+ "__gensym__my_var506"])
+
+(documentation: /.text
+ "A text literal made by concatenating pieces of code."
+ [(text [#0 123 +456 +789.0 "abc" .def ..ghi])
+ "=>"
+ "#0123+456+789.0abcdefghi"])
+
+(template [<a/an> <name> <short_example> <full_example>]
+ [(documentation: <name>
+ (format <a/an> " " (/.text [<name>]) " made by concatenating pieces of code."
+ \n "The (optional) module part and the short part are specified independently.")
+ [(<name> ["abc" .def ..ghi])
+ "=>"
+ <short_example>]
+ [(<name> [.def] ["abc" .def ..ghi])
+ "=>"
+ <full_example>])]
+
+ ["An" /.identifier abcdefghi .abcdefghi]
+ ["A" /.tag #abcdefghi #.abcdefghi]
+ )
+
+(documentation: /.let
+ "Lexically-bound templates."
+ [(let [(!square <root>)
+ [(* <root> <root>)]]
+ (def: (square root)
+ (-> Nat Nat)
+ (!square root)))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..spliced
+ ..amount
+ ..with_locals
+ ..text
+ ..identifier
+ ..tag
+ ..let
+ ($.default /.irregular_arguments)]
+ []))
diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux
new file mode 100644
index 000000000..7c74692ca
--- /dev/null
+++ b/stdlib/source/documentation/lux/math.lux
@@ -0,0 +1,28 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." infix]
+ ... ["#." modulus]
+ ... ["#." modular]
+ ... ["#." number]
+ ["#." logic]]
+ [\\library
+ ["." /]])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ []
+ [/infix.documentation
+ ... /modulus.documentation
+ ... /modular.documentation
+ ... /number.documentation
+ /logic.documentation]))
diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux
new file mode 100644
index 000000000..ccb72f665
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/infix.lux
@@ -0,0 +1,31 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.infix
+ (format "Infix math syntax."
+ \n "The rules for infix syntax are simple."
+ \n "If you want your binary function to work well with it."
+ \n "Then take the argument to the right (y) as your first argument,"
+ \n "and take the argument to the left (x) as your second argument.")
+ [(infix [x * +10])]
+ [(infix [[x + y] * [x - y]])]
+ [(infix [sin [x + y]])]
+ [(infix [[x < y] and [y < z]])]
+ [(infix [#and x < y < z])]
+ [(infix [(* 3 9) gcd 450])])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ []
+ []))
diff --git a/stdlib/source/documentation/lux/math/logic.lux b/stdlib/source/documentation/lux/math/logic.lux
new file mode 100644
index 000000000..1b455c23e
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/logic.lux
@@ -0,0 +1,22 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ ["." / #_
+ ["#." continuous]
+ ["#." fuzzy]]
+ [\\library
+ ["." /]])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ []
+ [/continuous.documentation
+ /fuzzy.documentation]))
diff --git a/stdlib/source/documentation/lux/math/logic/continuous.lux b/stdlib/source/documentation/lux/math/logic/continuous.lux
new file mode 100644
index 000000000..94c7486d4
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/logic/continuous.lux
@@ -0,0 +1,32 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.implies
+ ""
+ [(implies consequent antecedent)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ (format "Continuous logic using Rev values."
+ \n "Continuous logic is logic in the interval [0,1] instead of just the binary #0 and #1 options."
+ \n "Because Rev is being used, the interval is actual [0,1).")
+ [..implies
+ ($.default /.false)
+ ($.default /.true)
+ ($.default /.or)
+ ($.default /.disjunction)
+ ($.default /.and)
+ ($.default /.conjunction)
+ ($.default /.not)
+ ($.default /.=)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/logic/fuzzy.lux b/stdlib/source/documentation/lux/math/logic/fuzzy.lux
new file mode 100644
index 000000000..5f31cfea1
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/logic/fuzzy.lux
@@ -0,0 +1,68 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Fuzzy
+ "A fuzzy set.")
+
+(documentation: /.membership
+ ""
+ [(membership set elem)])
+
+(documentation: /.difference
+ ""
+ [(difference sub base)])
+
+(documentation: /.of_predicate
+ ""
+ [(of_predicate predicate)])
+
+(documentation: /.predicate
+ ""
+ [(predicate treshold set)])
+
+(documentation: /.gradient
+ ""
+ [(gradient from to)])
+
+(documentation: /.triangle
+ ""
+ [(triangle bottom middle top)])
+
+(documentation: /.trapezoid
+ ""
+ [(trapezoid bottom middle_bottom middle_top top)])
+
+(documentation: /.cut
+ ""
+ [(cut treshold set)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Fuzzy logic, implemented on top of the Rev type."
+ [..Fuzzy
+ ..membership
+ ..difference
+ ..of_predicate
+ ..predicate
+ ..gradient
+ ..triangle
+ ..trapezoid
+ ..cut
+ ($.default /.functor)
+ ($.default /.empty)
+ ($.default /.full)
+ ($.default /.union)
+ ($.default /.intersection)
+ ($.default /.complement)
+ ($.default /.of_set)]
+ []))
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 50fe70f4e..986378ad7 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -3937,7 +3937,7 @@
(in_meta [#All tokens'])
(^or (^ (list& [_ (#Tag ["" "_"])] tokens'))
- (^ (list& [_ (#Tag ["" "nothing"])] tokens')))
+ (^ (list& [_ (#Tag ["" "ignore"])] tokens')))
(in_meta [#Ignore tokens'])
_
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 096c25a9a..70b0360b1 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -20,7 +20,6 @@
["." i64]]]]])
(type: .public Char
- {#.doc (example "A character code number.")}
Nat)
... TODO: Instead of ints, chars should be produced fron nats.
@@ -45,7 +44,6 @@
)
(def: .public line_feed
- {#.doc (example "Same as 'new_line'.")}
..new_line)
(def: .public size
@@ -53,7 +51,6 @@
(|>> "lux text size"))
(def: .public (char index input)
- {#.doc (example "Yields the character at the specified index.")}
(-> Nat Text (Maybe Char))
(if (n.< ("lux text size" input) index)
(#.Some ("lux text char" index input))
@@ -126,12 +123,10 @@
("lux text concat" subject param))
(def: .public (enclosed [left right] content)
- {#.doc "Surrounds the given content text with left and right side additions."}
(-> [Text Text] Text Text)
($_ "lux text concat" left content right))
(def: .public (enclosed' boundary content)
- {#.doc "Surrounds the given content text with the same boundary text."}
(-> Text Text Text)
(enclosed [boundary boundary] content))
@@ -140,14 +135,12 @@
(..enclosed' ..double_quote))
(def: .public (clip offset size input)
- {#.doc (example "Clips a chunk of text from the input at the specified offset and of the specified size.")}
(-> Nat Nat Text (Maybe Text))
(if (|> size (n.+ offset) (n.<= ("lux text size" input)))
(#.Some ("lux text clip" offset size input))
#.None))
(def: .public (clip' offset input)
- {#.doc (example "Clips the remaining text from the input at the specified offset.")}
(-> Nat Text (Maybe Text))
(let [size ("lux text size" input)]
(if (n.<= size offset)
@@ -314,7 +307,6 @@
" ")
(def: .public (space? char)
- {#.doc "Checks whether the character is white-space."}
(-> Char Bit)
(with_expansions [<options> (template [<char>]
[(^ (.char (~~ (static <char>))))]
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 37147b2f0..aca2b4e89 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -258,20 +258,20 @@
(syntax: .public (default [name ..qualified_identifier])
(let [[_ short] name]
- (in (list (` (: ..Definition
- {#..definition (~ (code.text short))
- #..documentation ((~! ..minimal_definition_documentation)
- (~ (code.identifier name)))}))))))
+ (in (list (` (: (.List ..Definition)
+ (list {#..definition (~ (code.text short))
+ #..documentation ((~! ..minimal_definition_documentation)
+ (~ (code.identifier name)))})))))))
(syntax: .public (documentation: [name ..qualified_identifier
extra (<>.some <code>.any)])
(let [[_ short] name]
(in (list (` (.def: .public (~ (code.local_identifier short))
- ..Definition
- {#..definition (~ (code.text short))
- #..documentation ((~! ..definition_documentation)
- (~ (code.identifier name))
- (~+ extra))}))))))
+ (.List ..Definition)
+ (.list {#..definition (~ (code.text short))
+ #..documentation ((~! ..definition_documentation)
+ (~ (code.identifier name))
+ (~+ extra))})))))))
(def: definitions_documentation
(-> (List Definition) (Markdown Block))
@@ -318,7 +318,7 @@
(~ (code.text (|> expected
(list\map product.left)
..expected_format)))
- (list (~+ definitions)))
+ ((~! list.together) (list (~+ definitions))))
($_ (\ (~! list.monoid) (~' compose))
(: (List Module)
(\ (~! list.monoid) (~' identity)))
diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux
index 5ff8380b5..39befd846 100644
--- a/stdlib/source/library/lux/locale.lux
+++ b/stdlib/source/library/lux/locale.lux
@@ -17,7 +17,7 @@
["." territory (#+ Territory)]])
(abstract: .public Locale
- {#.doc (example "A description of a locale; with territory, (optional) language, and (optional) text-encoding.")}
+ {}
Text
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index 29ec7c190..1739135aa 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -13,7 +13,7 @@
... https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
(abstract: .public Language
- {#.doc (example "An ISO 639 language.")}
+ {}
{#name Text
#code Text}
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index 6309e1a86..c4172993a 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -13,7 +13,7 @@
... https://en.wikipedia.org/wiki/ISO_3166-1
(abstract: .public Territory
- {#.doc (example "An ISO 3166 territory.")}
+ {}
{#name Text
#short Text
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index f6e2e1716..8e11c4a58 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -19,8 +19,6 @@
["." location]]])
(def: .public (single_expansion syntax)
- {#.doc (example "Given code that requires applying a macro, does it once and returns the result."
- "Otherwise, returns the code as-is.")}
(-> Code (Meta (List Code)))
(case syntax
[_ (#.Form (#.Item [[_ (#.Identifier name)] args]))]
@@ -37,8 +35,6 @@
(\ //.monad in (list syntax))))
(def: .public (expansion syntax)
- {#.doc (example "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
- "Otherwise, returns the code as-is.")}
(-> Code (Meta (List Code)))
(case syntax
[_ (#.Form (#.Item [[_ (#.Identifier name)] args]))]
@@ -59,7 +55,6 @@
(\ //.monad in (list syntax))))
(def: .public (full_expansion syntax)
- {#.doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."}
(-> Code (Meta (List Code)))
(case syntax
[_ (#.Form (#.Item [[_ (#.Identifier name)] args]))]
@@ -107,8 +102,6 @@
(\ //.monad in (list syntax))))
(def: .public (identifier prefix)
- {#.doc (example "Generates a unique name as an Code node (ready to be used in code templates)."
- "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.")}
(-> Text (Meta Code))
(do //.monad
[id //.seed]
@@ -127,23 +120,12 @@
(//.failure (text\compose "Code is not a local identifier: " (code.format ast)))))
(def: .public wrong_syntax_error
- {#.doc (example "A generic error message for macro syntax failures.")}
(-> Name Text)
(|>> name\encode
(text.prefix (text\compose "Wrong syntax for " text.\''))
(text.suffix (text\compose text.\'' "."))))
(macro: .public (with_identifiers tokens)
- {#.doc (example "Creates new identifiers and offers them to the body expression."
- (syntax: .public (synchronized [lock any
- body any])
- (with_identifiers [g!lock g!body g!_]
- (in (list (` (let [(~ g!lock) (~ lock)
- (~ g!_) ("jvm monitorenter" (~ g!lock))
- (~ g!body) (~ body)
- (~ g!_) ("jvm monitorexit" (~ g!lock))]
- (~ g!body)))))
- )))}
(case tokens
(^ (list [_ (#.Tuple identifiers)] body))
(do {! //.monad}
@@ -159,7 +141,6 @@
(//.failure (..wrong_syntax_error (name_of ..with_identifiers)))))
(def: .public (one_expansion token)
- {#.doc "Works just like expand, except that it ensures that the output is a single Code token."}
(-> Code (Meta Code))
(do //.monad
[token+ (..expansion token)]
@@ -172,13 +153,6 @@
(template [<macro> <func>]
[(macro: .public (<macro> tokens)
- {#.doc (example "Performs a macro-expansion and logs the resulting code."
- "You can either use the resulting code, or omit them."
- "By omitting them, this macro produces nothing (just like the lux.comment macro)."
- (<macro> #omit
- (def: (foo bar baz)
- (-> Int Int Int)
- (int.+ bar baz))))}
(let [[module _] (name_of .._)
[_ short] (name_of <macro>)
macro_name [module short]]
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index 7e09ceb96..79eebb5df 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -53,14 +53,13 @@
[record (List [Code Code]) #.Record]
)
-(template [<name> <tag> <doc>]
+(template [<name> <tag>]
[(def: .public (<name> name)
- {#.doc <doc>}
(-> Text Code)
[location.dummy (<tag> ["" name])])]
- [local_identifier #.Identifier "Produces a local identifier (an identifier with no module prefix)."]
- [local_tag #.Tag "Produces a local tag (a tag with no module prefix)."])
+ [local_identifier #.Identifier]
+ [local_tag #.Tag])
(implementation: .public equivalence
(Equivalence Code)
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 8c518b855..d17ae7728 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -96,10 +96,6 @@
(list)))))))
(def: .public (push macros)
- {#.doc (example "Installs macros in the compiler-state, with the given names."
- "Yields code that can be placed either as expression or as directives."
- "This code un-installs the macros."
- "NOTE: Always use this code once to clean-up..")}
(-> (List [Name Macro]) (Meta Code))
(do meta.monad
[_ (monad.map meta.monad ..push_one macros)
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index cdb788bc9..4caed5bd7 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -42,22 +42,6 @@
(#.Item [[x y] pairs']) (list& x y (un_paired pairs'))))
(macro: .public (syntax: tokens)
- {#.doc (example "A more advanced way to define macros than 'macro:'."
- "The inputs to the macro can be parsed in complex ways through the use of syntax parsers."
- "The macro body is also (implicitly) run in the Meta monad, to save some typing."
- "Also, the compiler state can be accessed through the *lux* binding."
- (syntax: .public (object [.let [imports (class_imports *lux*)]
- .let [class_vars (list)]
- super (opt (super_class_decl^ imports class_vars))
- interfaces (tuple (some (super_class_decl^ imports class_vars)))
- constructor_args (constructor_args^ imports class_vars)
- methods (some (overriden_method_def^ imports))])
- (let [def_code ($_ text\compose "anon-class:"
- (spaced (list (super_class_decl$ (maybe.else object_super_class super))
- (with_brackets (spaced (list\map super_class_decl$ interfaces)))
- (with_brackets (spaced (list\map constructor_arg$ constructor_args)))
- (with_brackets (spaced (list\map (method_def$ id) methods))))))]
- (in (list (` ((~ (code.text def_code)))))))))}
(let [?parts (: (Maybe [Code Text (List Code) Code Code])
(case tokens
(^ (list export_policy
diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux
index 5e23ea9d8..29ef222c2 100644
--- a/stdlib/source/library/lux/macro/syntax/annotations.lux
+++ b/stdlib/source/library/lux/macro/syntax/annotations.lux
@@ -16,7 +16,6 @@
["." code]]]])
(type: .public Annotations
- {#.doc (example "Definition/module annotations.")}
(List [Name Code]))
(def: .public equivalence
diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux
index 26450894a..8c045da18 100644
--- a/stdlib/source/library/lux/macro/syntax/check.lux
+++ b/stdlib/source/library/lux/macro/syntax/check.lux
@@ -18,7 +18,6 @@
"lux check")
(type: .public Check
- {#.doc (example "A type annotation for an expression.")}
{#type Code
#value Code})
diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux
index 1a529d3db..004398916 100644
--- a/stdlib/source/library/lux/macro/syntax/declaration.lux
+++ b/stdlib/source/library/lux/macro/syntax/declaration.lux
@@ -15,7 +15,6 @@
["." code]]]])
(type: .public Declaration
- {#.doc (example "A declaration for either a constant or a function.")}
{#name Text
#arguments (List Text)})
@@ -27,10 +26,6 @@
))
(def: .public parser
- {#.doc (example "A parser for declaration syntax."
- "Such as:"
- quux
- (foo bar baz))}
(Parser Declaration)
(<>.either (<>.and <code>.local_identifier
(<>\in (list)))
diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux
index 79fde60e7..601f44283 100644
--- a/stdlib/source/library/lux/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/macro/syntax/definition.lux
@@ -26,7 +26,6 @@
["#." check (#+ Check)]])
(type: .public Definition
- {#.doc (example "Syntax for a constant definition.")}
{#name Text
#value (Either Check
Code)
@@ -101,7 +100,6 @@
))))
(def: .public (parser compiler)
- {#.doc "A reader that first macro-expands and then analyses the input Code, to ensure it is a definition."}
(-> Lux (Parser Definition))
(do {! <>.monad}
[raw <code>.any
@@ -129,7 +127,6 @@
["Definition" (%.code (..format definition))]))
(def: .public (typed compiler)
- {#.doc "Only works for typed definitions."}
(-> Lux (Parser Definition))
(do <>.monad
[definition (..parser compiler)
diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux
index 077e36256..e4cb2ddac 100644
--- a/stdlib/source/library/lux/macro/syntax/export.lux
+++ b/stdlib/source/library/lux/macro/syntax/export.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc (.example "Syntax for marking a definition as an export.")}
[library
[lux #*
[control
diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux
index 77623fbd7..58675bbf7 100644
--- a/stdlib/source/library/lux/macro/syntax/input.lux
+++ b/stdlib/source/library/lux/macro/syntax/input.lux
@@ -12,7 +12,6 @@
["." code]]]])
(type: .public Input
- {#.doc (example "The common typed-argument syntax used by many macros.")}
{#binding Code
#type Code})
@@ -30,7 +29,6 @@
(value@ #type value)])))
(def: .public parser
- {#.doc "Parser for the common typed-argument syntax used by many macros."}
(Parser Input)
(<code>.record
($_ <>.and
diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux
index 9f69dfbe0..7e66ca622 100644
--- a/stdlib/source/library/lux/macro/syntax/type/variable.lux
+++ b/stdlib/source/library/lux/macro/syntax/type/variable.lux
@@ -12,7 +12,6 @@
["." code]]]])
(type: .public Variable
- {#.doc (example "A variable'S name.")}
Text)
(def: .public equivalence
@@ -24,6 +23,5 @@
code.local_identifier)
(def: .public parser
- {#.doc "Parser for the common type variable/parameter used by many macros."}
(Parser Variable)
<code>.local_identifier)
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index d378f9409..aac7af03c 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -35,12 +35,6 @@
(syntax: .public (with_locals [locals (<code>.tuple (<>.some <code>.local_identifier))
body <code>.any])
- {#.doc (example "Creates names for local bindings aliased by the names you choose."
- (with_locals [my_var]
- (let [my_var 123]
- (..text [my_var])))
- "=>"
- "__gensym__my_var506")}
(do {! meta.monad}
[g!locals (|> locals
(list\map //.identifier)
@@ -87,38 +81,21 @@
(<code>.tuple (<>.many (..snippet module_side?))))
(syntax: .public (text [simple (..part false)])
- {#.doc (example "A text literal made by concatenating pieces of code."
- (text [#0 123 +456 +789.0 "abc" .def ..ghi])
- "=>"
- "#0123+456+789.0abcdefghi")}
(in (list (|> simple (text.interposed "") code.text))))
-(template [<a/an> <name> <simple> <complex> <short_example> <full_example>]
- [(`` (syntax: .public (<name> [name (<>.or (<>.and (..part true) (..part false))
- (..part false))])
- {#.doc (example (~~ (..text [<a/an> " " <name> " made by concatenating pieces of code."]))
- "The (optional) module part and the short part are specified independently."
- (<name> ["abc" .def ..ghi])
- "=>"
- <short_example>
- "--------------"
- (<name> [.def] ["abc" .def ..ghi])
- "=>"
- <full_example>)}
- (case name
- (#.Left [simple complex])
- (in (list (<complex> [(text.interposed "" simple)
- (text.interposed "" complex)])))
-
- (#.Right simple)
- (in (list (|> simple (text.interposed "") <simple>))))))]
-
- ["An" identifier code.local_identifier code.identifier
- abcdefghi
- .abcdefghi]
- ["A" tag code.local_tag code.tag
- #abcdefghi
- #.abcdefghi]
+(template [<name> <simple> <complex>]
+ [(syntax: .public (<name> [name (<>.or (<>.and (..part true) (..part false))
+ (..part false))])
+ (case name
+ (#.Left [simple complex])
+ (in (list (<complex> [(text.interposed "" simple)
+ (text.interposed "" complex)])))
+
+ (#.Right simple)
+ (in (list (|> simple (text.interposed "") <simple>)))))]
+
+ [identifier code.local_identifier code.identifier]
+ [tag code.local_tag code.tag]
)
(type: Environment
@@ -186,12 +163,6 @@
(syntax: .public (let [locals (<code>.tuple (<>.some ..local))
body <code>.any])
- {#.doc (example "Lexically-bound templates."
- (let [(!square <root>)
- [(nat.* <root> <root>)]]
- (def: (square root)
- (-> Nat Nat)
- (!square root))))}
(do meta.monad
[here_name meta.current_module_name
expression? (: (Meta Bit)
diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux
index 12611788f..f63e86a4d 100644
--- a/stdlib/source/library/lux/math/infix.lux
+++ b/stdlib/source/library/lux/math/infix.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Common mathematical constants and functions."}
[library
[lux #*
[abstract
@@ -85,16 +84,4 @@
(` ((~ op) (~ (prefix right)) (~ (prefix left))))))
(syntax: .public (infix [expr ..expression])
- {#.doc (example "Infix math syntax."
- (infix [x i.* +10])
- (infix [[x i.+ y] i.* [x i.- y]])
- (infix [sin [x i.+ y]])
- (infix [[x n.< y] and [y n.< z]])
- (infix [#and x n.< y n.< z])
- (infix [(n.* 3 9) gcd 450])
-
- "The rules for infix syntax are simple."
- "If you want your binary function to work well with it."
- "Then take the argument to the right (y) as your first argument,"
- "and take the argument to the left (x) as your second argument.")}
(in (list (..prefix expr))))
diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux
index cffcc4e5d..6f7e4d116 100644
--- a/stdlib/source/library/lux/math/logic/continuous.lux
+++ b/stdlib/source/library/lux/math/logic/continuous.lux
@@ -1,8 +1,5 @@
... https://en.wikipedia.org/wiki/Many-valued_logic
(.module:
- {#.doc (.example "Continuous logic using Rev values."
- "Continuous logic is logic in the interval [0,1] instead of just the binary #0 and #1 options."
- "Because Rev is being used, the interval is actual [0,1).")}
[library
[lux (#- false true or and not)
[abstract
diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux
index 843af83ad..5a21a6e39 100644
--- a/stdlib/source/library/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/library/lux/math/logic/fuzzy.lux
@@ -1,6 +1,5 @@
... https://en.wikipedia.org/wiki/Fuzzy_logic
(.module:
- {#.doc "Fuzzy logic, implemented on top of the Rev type."}
[library
[lux #*
[abstract
@@ -18,7 +17,6 @@
["#" continuous]])
(type: .public (Fuzzy a)
- {#.doc (example "A fuzzy set.")}
(-> a Rev))
(implementation: .public functor
diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux
new file mode 100644
index 000000000..0a506ef2d
--- /dev/null
+++ b/stdlib/source/library/lux/static.lux
@@ -0,0 +1,71 @@
+(.module:
+ [library
+ [lux (#- nat int rev)
+ ["." meta]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [macro
+ [syntax (#+ syntax:)]
+ ["." code]]
+ [math
+ [number (#+ hex)]
+ ["." random (#+ Random)]]]])
+
+(template [<name> <type> <format>]
+ [(syntax: .public (<name> [expression <code>.any])
+ (\ meta.monad map
+ (|>> (:as <type>) <format> list)
+ (meta.eval <type> expression)))]
+
+ [nat .Nat code.nat]
+ [int .Int code.int]
+ [rev .Rev code.rev]
+ [frac .Frac code.frac]
+ [text .Text code.text]
+ )
+
+(def: pcg_32_magic_inc
+ Nat
+ (hex "FEDCBA9876543210"))
+
+(with_expansions [<type> (Ex [a]
+ [(-> a Code)
+ a])]
+ (syntax: .public (literal [format <code>.any
+ expression <code>.any])
+ (do meta.monad
+ [pair (meta.eval (type <type>)
+ (` [(~ format) (~ expression)]))
+ .let [[format expression] (:as <type> pair)]]
+ (in (list (format expression))))))
+
+(template [<name> <random> <format>]
+ [(syntax: .public (<name> [])
+ (do meta.monad
+ [seed meta.seed
+ .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed])
+ <random>)]]
+ (in (list (<format> result)))))]
+
+ [random_nat random.nat code.nat]
+ [random_int random.int code.int]
+ [random_rev random.rev code.rev]
+ [random_frac random.frac code.frac]
+ )
+
+(with_expansions [<type> (Ex [a]
+ [(-> a Code)
+ (Random a)])]
+ (syntax: .public (random [format <code>.any
+ random <code>.any])
+ (do meta.monad
+ [pair (meta.eval (type <type>)
+ (` [(~ format) (~ random)]))
+ .let [[format random] (:as <type> pair)]
+ seed meta.seed
+ .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed])
+ random)]]
+ (in (list (format result))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
index 329c79611..c5f410370 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
@@ -236,6 +236,14 @@
_
(phase.except ///.invalid_syntax [extension_name %.code inputsC+]))))
+(def: (announce_tags! tags owner)
+ (All [anchor expression directive]
+ (-> (List Text) Type (Operation anchor expression directive (List Any))))
+ (/////directive.lifted_generation
+ (monad.map phase.monad (function (_ tag)
+ (/////generation.log! (format "#" tag " : Tag of " (%.type owner))))
+ tags)))
+
(def: (def::type_tagged expander host_analysis)
(-> Expander /////analysis.Bundle Handler)
(..custom
@@ -255,7 +263,8 @@
[_ (module.define short_name (#.Right [exported? type annotations value]))]
(module.declare_tags tags exported? (:as Type value))))
_ (..refresh expander host_analysis)
- _ (..announce_definition! short_name type)]
+ _ (..announce_definition! short_name type)
+ _ (..announce_tags! tags (:as Type value))]
(in /////directive.no_requirements)))]))
(def: imports
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 6eab1c60b..68f155559 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -56,6 +56,7 @@
["#." math]
["#." meta]
["#." program]
+ ["#." static]
["#." target]
["#." test]
["#." time]
@@ -93,6 +94,7 @@
/meta.test
/program.test
+ /static.test
/target.test
/test.test
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 6efd24021..bf7c312c9 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -52,7 +52,8 @@
(_.for [/.Definition]
($_ _.and
(_.cover [/.default]
- (let [definition (`` (/.default (~~ (template.identifier [.._] [g!default]))))]
+ (case (`` (/.default (~~ (template.identifier [.._] [g!default]))))
+ (^ (list definition))
(and (|> definition
(value@ #/.definition)
(text\= (template.text [g!default])))
@@ -60,15 +61,23 @@
(value@ #/.documentation)
md.markdown
(text\= "")
- not))))
+ not))
+
+ _
+ false))
(_.cover [/.documentation:]
- (and (|> ..documentation:
- (value@ #/.definition)
- (text\= (template.text [/.documentation:])))
- (|> ..documentation:
- (value@ #/.documentation)
- md.markdown
- (text.contains? 'definition_description'))))
+ (case ..documentation:
+ (^ (list documentation:))
+ (and (|> documentation:
+ (value@ #/.definition)
+ (text\= (template.text [/.documentation:])))
+ (|> documentation:
+ (value@ #/.documentation)
+ md.markdown
+ (text.contains? 'definition_description')))
+
+ _
+ false))
))
(_.for [/.Module]
($_ _.and
@@ -87,8 +96,13 @@
(/.documentation super))
(text.contains? (template.text ['super_description'])
(/.documentation super))
- (text.contains? (md.markdown (value@ #/.documentation ..documentation:))
- (/.documentation super)))))
+ (case ..documentation:
+ (^ (list documentation:))
+ (text.contains? (md.markdown (value@ #/.documentation documentation:))
+ (/.documentation super))
+
+ _
+ false))))
))
(_.cover [/.unqualified_identifier]
(`` (and (~~ (template [<example>]
diff --git a/stdlib/source/test/lux/static.lux b/stdlib/source/test/lux/static.lux
new file mode 100644
index 000000000..d54751f43
--- /dev/null
+++ b/stdlib/source/test/lux/static.lux
@@ -0,0 +1,76 @@
+(.module:
+ [library
+ [lux #*
+ ["_" test (#+ Test)]
+ ["." meta]
+ [data
+ ["." text ("#\." equivalence)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." code]]
+ [math
+ ["." random]
+ [number
+ ["n" nat]
+ ["i" int]
+ ["r" rev]
+ ["f" frac]]]]]
+ [\\library
+ ["." /]])
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [meta.eval])
+ (`` ($_ _.and
+ (~~ (template [<static> <random> <=> <+> <tag>]
+ [(_.cover [<static> <random>]
+ (with_expansions [<left> (<random>)
+ <right> (<random>)
+ <l+r> (<static> (<+> <left> <right>))]
+ (case (' <l+r>)
+ [_ (<tag> l+r)]
+ (<=> l+r (<+> <left> <right>))
+
+ _
+ false)))]
+
+ [/.nat /.random_nat n.= n.+ #.Nat]
+ [/.int /.random_int i.= i.+ #.Int]
+ [/.rev /.random_rev r.= r.+ #.Rev]
+ ))
+ (_.cover [/.frac /.random_frac]
+ (with_expansions [<left> (/.random_frac)
+ <right> (/.random_frac)
+ <l+r> (/.frac (f.+ <left> <right>))]
+ (case (' <l+r>)
+ [_ (#.Frac l+r)]
+ (or (f.= l+r (f.+ <left> <right>))
+ (and (f.not_a_number? l+r)
+ (f.not_a_number? (f.+ <left> <right>))
+ (or (f.not_a_number? <left>)
+ (f.not_a_number? <right>))))
+
+ _
+ false)))
+ (_.cover [/.text /.random]
+ (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1))
+ <right> (/.random code.text (random.ascii/alpha_num 1))
+ <l+r> (/.text (format <left> <right>))]
+ (case (' <l+r>)
+ [_ (#.Text l+r)]
+ (text\= l+r (format <left> <right>))
+
+ _
+ false)))
+ (_.cover [/.literal]
+ (with_expansions [<left> (/.random code.text (random.ascii/alpha_num 1))
+ <right> (/.random code.text (random.ascii/alpha_num 1))
+ <l+r> (/.literal code.text (format <left> <right>))]
+ (case (' <l+r>)
+ [_ (#.Text l+r)]
+ (text\= l+r (format <left> <right>))
+
+ _
+ false)))
+ ))))