aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/control/thread.lux4
-rw-r--r--stdlib/source/lux/data/binary.lux6
-rw-r--r--stdlib/source/lux/data/text.lux4
-rw-r--r--stdlib/source/lux/host.js.lux29
-rw-r--r--stdlib/source/lux/host.py.lux18
-rw-r--r--stdlib/source/lux/locale/language.lux1050
-rw-r--r--stdlib/source/lux/macro.lux2
-rw-r--r--stdlib/source/lux/target/js.lux2
-rw-r--r--stdlib/source/lux/target/python.lux17
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux343
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/python.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux100
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux8
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux35
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux53
-rw-r--r--stdlib/source/lux/type.lux10
-rw-r--r--stdlib/source/lux/type/quotient.lux40
-rw-r--r--stdlib/source/program/aedifex/artifact/snapshot/version/value.lux42
-rw-r--r--stdlib/source/program/aedifex/artifact/value.lux47
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/snapshot/version/value.lux66
-rw-r--r--stdlib/source/test/aedifex/artifact/value.lux38
-rw-r--r--stdlib/source/test/lux/control/concurrency/promise.lux11
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux17
-rw-r--r--stdlib/source/test/lux/data/binary.lux23
-rw-r--r--stdlib/source/test/lux/extension.lux7
-rw-r--r--stdlib/source/test/lux/host.py.lux24
-rw-r--r--stdlib/source/test/lux/math.lux3
-rw-r--r--stdlib/source/test/lux/type.lux2
-rw-r--r--stdlib/source/test/lux/type/quotient.lux60
31 files changed, 1126 insertions, 943 deletions
diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux
index 2aef71e06..7147c2517 100644
--- a/stdlib/source/lux/control/thread.lux
+++ b/stdlib/source/lux/control/thread.lux
@@ -42,8 +42,8 @@
"jvm conversion long-to-int")
(:representation box))
- @.js
- ("js array read" 0 (:representation box))})))
+ @.js ("js array read" 0 (:representation box))
+ @.python ("python array read" 0 (:representation box))})))
(def: #export (write value box)
(All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any)))))
diff --git a/stdlib/source/lux/data/binary.lux b/stdlib/source/lux/data/binary.lux
index e74517756..ccf4f54b4 100644
--- a/stdlib/source/lux/data/binary.lux
+++ b/stdlib/source/lux/data/binary.lux
@@ -120,13 +120,13 @@
(|> binary
(: ..Binary)
(:coerce (array.Array .Frac))
- ("js array write" idx (n.frac (.nat value)))
+ ("js array write" idx (n.frac (n.% (hex "100") (.nat value))))
(:coerce ..Binary))
@.python
(|> binary
(:coerce (array.Array (I64 Any)))
- ("python array write" idx (:coerce (I64 Any) (i64.and (hex "FF") value)))
+ ("python array write" idx (:coerce (I64 Any) (n.% (hex "100") (.nat value))))
(:coerce ..Binary))}))
(def: #export size
@@ -292,7 +292,7 @@
@.jvm <jvm>}
## Default
- (let [how_many (n.- from to)]
+ (let [how_many (inc (n.- from to))]
(..copy how_many from binary 0 (..create how_many)))))
(exception.throw ..slice_out_of_bounds [size from to]))
(exception.throw ..inverted_slice [size from to]))))
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux
index 031d76a07..0b07b3ae1 100644
--- a/stdlib/source/lux/data/text.lux
+++ b/stdlib/source/lux/data/text.lux
@@ -43,9 +43,9 @@
(def: #export line_feed ..new_line)
-(def: #export (size x)
+(def: #export size
(-> Text Nat)
- ("lux text size" x))
+ (|>> "lux text size"))
(def: #export (nth idx input)
(-> Nat Text (Maybe Char))
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux
index 2935f9e16..8bfe8cc94 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -21,13 +21,16 @@
["." code]
["." template]]])
-(abstract: #export (Object brand) Any)
+(abstract: #export (Object brand)
+ Any)
(template [<name>]
[(with_expansions [<brand> (template.identifier [<name> "'"])]
- (abstract: #export <brand> Any)
- (type: #export <name>
- (Object <brand>)))]
+ (abstract: <brand>
+ Any
+
+ (type: #export <name>
+ (Object <brand>))))]
[Function]
[Symbol]
@@ -148,16 +151,14 @@
(def: (without_null g!temp [nullable? outputT] output)
(-> Code Nullable Code Code)
(if nullable?
- (` (: (Maybe (~ outputT))
- (let [(~ g!temp) (~ output)]
- (if ("js object null?" (~ g!temp))
- #.None
- (#.Some (~ g!temp))))))
- (` (: (~ outputT)
- (let [(~ g!temp) (~ output)]
- (if ("js object null?" (~ g!temp))
- (.error "Null is an invalid value.")
- (~ g!temp)))))))
+ (` (let [(~ g!temp) (~ output)]
+ (if ("js object null?" (~ g!temp))
+ #.None
+ (#.Some (~ g!temp)))))
+ (` (let [(~ g!temp) (~ output)]
+ (if (not ("js object null?" (~ g!temp)))
+ (~ g!temp)
+ (.error! "Null is an invalid value."))))))
(type: Import
(#Class [Text (List Member)])
diff --git a/stdlib/source/lux/host.py.lux b/stdlib/source/lux/host.py.lux
index 5405d65a5..ed67b3705 100644
--- a/stdlib/source/lux/host.py.lux
+++ b/stdlib/source/lux/host.py.lux
@@ -149,16 +149,14 @@
(def: (without_none g!temp [noneable? outputT] output)
(-> Code Noneable Code Code)
(if noneable?
- (` (: (Maybe (~ outputT))
- (let [(~ g!temp) (~ output)]
- (if ("python object none?" (~ g!temp))
- #.None
- (#.Some (~ g!temp))))))
- (` (: (~ outputT)
- (let [(~ g!temp) (~ output)]
- (if ("python object none?" (~ g!temp))
- (.error! "None is an invalid value!")
- (~ g!temp)))))))
+ (` (let [(~ g!temp) (~ output)]
+ (if ("python object none?" (~ g!temp))
+ #.None
+ (#.Some (~ g!temp)))))
+ (` (let [(~ g!temp) (~ output)]
+ (if (not ("python object none?" (~ g!temp)))
+ (~ g!temp)
+ (.error! "None is an invalid value!"))))))
(type: Import
(#Class [Text (List Member)])
diff --git a/stdlib/source/lux/locale/language.lux b/stdlib/source/lux/locale/language.lux
index 81b9b1ee3..604363844 100644
--- a/stdlib/source/lux/locale/language.lux
+++ b/stdlib/source/lux/locale/language.lux
@@ -24,531 +24,535 @@
[code #code]
)
- (template [<code> <name> <definition> <alias>+]
- [(def: #export <definition>
- Language
- (:abstraction {#name <name>
- #code <code>}))
- (`` (template [<alias>]
- [(def: #export <alias>
- Language
- <definition>)]
-
- (~~ (template.splice <alias>+))))]
-
- ["mis" "uncoded languages" uncoded []]
- ["mul" "multiple languages" multiple []]
- ["und" "undetermined" undetermined []]
- ["zxx" "no linguistic content; not applicable" not_applicable []]
-
- ["aar" "Afar" afar []]
- ["abk" "Abkhazian" abkhazian []]
- ["ace" "Achinese" achinese []]
- ["ach" "Acoli" acoli []]
- ["ada" "Adangme" adangme []]
- ["ady" "Adyghe; Adygei" adyghe []]
- ["afa" "Afro-Asiatic languages" afro_asiatic []]
- ["afh" "Afrihili" afrihili []]
- ["afr" "Afrikaans" afrikaans []]
- ["ain" "Ainu" ainu []]
- ["aka" "Akan" akan []]
- ["akk" "Akkadian" akkadian []]
- ["ale" "Aleut" aleut []]
- ["alg" "Algonquian languages" algonquian []]
- ["alt" "Southern Altai" southern_altai []]
- ["amh" "Amharic" amharic []]
- ["ang" "Old English (ca.450–1100)" old_english []]
- ["anp" "Angika" angika []]
- ["apa" "Apache languages" apache []]
- ["ara" "Arabic" arabic []]
- ["arc" "Official Aramaic (700–300 BCE); Imperial Aramaic (700–300 BCE)" official_aramaic [[imperial_aramaic]]]
- ["arg" "Aragonese" aragonese []]
- ["arn" "Mapudungun; Mapuche" mapudungun []]
- ["arp" "Arapaho" arapaho []]
- ["art" "Artificial languages" artificial []]
- ["arw" "Arawak" arawak []]
- ["asm" "Assamese" assamese []]
- ["ast" "Asturian; Bable; Leonese; Asturleonese" asturian [[bable] [leonese] [asturleonese]]]
- ["ath" "Athapascan languages" athapascan []]
- ["aus" "Australian languages" australian []]
- ["ava" "Avaric" avaric []]
- ["ave" "Avestan" avestan []]
- ["awa" "Awadhi" awadhi []]
- ["aym" "Aymara" aymara []]
- ["aze" "Azerbaijani" azerbaijani []]
+ (template [<bundle>]
+ [(with_expansions [<bundle>' (template.splice <bundle>)]
+ (template [<code> <name> <definition> <alias>+]
+ [(def: #export <definition>
+ Language
+ (:abstraction {#name <name>
+ #code <code>}))
+ (`` (template [<alias>]
+ [(def: #export <alias>
+ Language
+ <definition>)]
+
+ (~~ (template.splice <alias>+))))]
+
+ <bundle>'
+ ))]
+
+ [[["mis" "uncoded languages" uncoded []]
+ ["mul" "multiple languages" multiple []]
+ ["und" "undetermined" undetermined []]
+ ["zxx" "no linguistic content; not applicable" not_applicable []]]]
+
+ [[["aar" "Afar" afar []]
+ ["abk" "Abkhazian" abkhazian []]
+ ["ace" "Achinese" achinese []]
+ ["ach" "Acoli" acoli []]
+ ["ada" "Adangme" adangme []]
+ ["ady" "Adyghe; Adygei" adyghe []]
+ ["afa" "Afro-Asiatic languages" afro_asiatic []]
+ ["afh" "Afrihili" afrihili []]
+ ["afr" "Afrikaans" afrikaans []]
+ ["ain" "Ainu" ainu []]
+ ["aka" "Akan" akan []]
+ ["akk" "Akkadian" akkadian []]
+ ["ale" "Aleut" aleut []]
+ ["alg" "Algonquian languages" algonquian []]
+ ["alt" "Southern Altai" southern_altai []]
+ ["amh" "Amharic" amharic []]
+ ["ang" "Old English (ca.450–1100)" old_english []]
+ ["anp" "Angika" angika []]
+ ["apa" "Apache languages" apache []]
+ ["ara" "Arabic" arabic []]
+ ["arc" "Official Aramaic (700–300 BCE); Imperial Aramaic (700–300 BCE)" official_aramaic [[imperial_aramaic]]]
+ ["arg" "Aragonese" aragonese []]
+ ["arn" "Mapudungun; Mapuche" mapudungun []]
+ ["arp" "Arapaho" arapaho []]
+ ["art" "Artificial languages" artificial []]
+ ["arw" "Arawak" arawak []]
+ ["asm" "Assamese" assamese []]
+ ["ast" "Asturian; Bable; Leonese; Asturleonese" asturian [[bable] [leonese] [asturleonese]]]
+ ["ath" "Athapascan languages" athapascan []]
+ ["aus" "Australian languages" australian []]
+ ["ava" "Avaric" avaric []]
+ ["ave" "Avestan" avestan []]
+ ["awa" "Awadhi" awadhi []]
+ ["aym" "Aymara" aymara []]
+ ["aze" "Azerbaijani" azerbaijani []]]]
- ["bad" "Banda languages" banda []]
- ["bai" "Bamileke languages" bamileke []]
- ["bak" "Bashkir" bashkir []]
- ["bal" "Baluchi" baluchi []]
- ["bam" "Bambara" bambara []]
- ["ban" "Balinese" balinese []]
- ["bas" "Basa" basa []]
- ["bat" "Baltic languages" baltic []]
- ["bej" "Beja; Bedawiyet" beja []]
- ["bel" "Belarusian" belarusian []]
- ["bem" "Bemba" bemba []]
- ["ben" "Bengali" bengali []]
- ["ber" "Berber languages" berber []]
- ["bho" "Bhojpuri" bhojpuri []]
- ["bih" "Bihari languages" bihari []]
- ["bik" "Bikol" bikol []]
- ["bin" "Bini; Edo" bini [[edo]]]
- ["bis" "Bislama" bislama []]
- ["bla" "Siksika" siksika []]
- ["bnt" "Bantu languages" bantu []]
- ["bod" "Tibetan" tibetan []]
- ["bos" "Bosnian" bosnian []]
- ["bra" "Braj" braj []]
- ["bre" "Breton" breton []]
- ["btk" "Batak languages" batak []]
- ["bua" "Buriat" buriat []]
- ["bug" "Buginese" buginese []]
- ["bul" "Bulgarian" bulgarian []]
- ["byn" "Blin; Bilin" blin [[bilin]]]
-
- ["cad" "Caddo" caddo []]
- ["cai" "Central American Indian languages" central_american_indian []]
- ["car" "Galibi Carib" galibi_carib []]
- ["cat" "Catalan; Valencian" catalan [[valencian]]]
- ["cau" "Caucasian languages" caucasian []]
- ["ceb" "Cebuano" cebuano []]
- ["cel" "Celtic languages" celtic []]
- ["ces" "Czech" czech []]
- ["cha" "Chamorro" chamorro []]
- ["chb" "Chibcha" chibcha []]
- ["che" "Chechen" chechen []]
- ["chg" "Chagatai" chagatai []]
- ["chk" "Chuukese" chuukese []]
- ["chm" "Mari" mari []]
- ["chn" "Chinook jargon" chinook []]
- ["cho" "Choctaw" choctaw []]
- ["chp" "Chipewyan; Dene Suline" chipewyan []]
- ["chr" "Cherokee" cherokee []]
- ["chu" "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic" church_slavic [[old_slavonic] [church_slavonic] [old_bulgarian] [old_church_slavonic]]]
- ["chv" "Chuvash" chuvash []]
- ["chy" "Cheyenne" cheyenne []]
- ["cmc" "Chamic languages" chamic []]
- ["cnr" "Montenegrin" montenegrin []]
- ["cop" "Coptic" coptic []]
- ["cor" "Cornish" cornish []]
- ["cos" "Corsican" corsican []]
- ["cpe" "Creoles and pidgins, English based" creoles_and_pidgins/english []]
- ["cpf" "Creoles and pidgins, French-based" creoles_and_pidgins/french []]
- ["cpp" "Creoles and pidgins, Portuguese-based" creoles_and_pidgins/portuguese []]
- ["cre" "Cree" cree []]
- ["crh" "Crimean Tatar; Crimean Turkish" crimean []]
- ["crp" "Creoles and pidgins" creoles_and_pidgins []]
- ["csb" "Kashubian" kashubian []]
- ["cus" "Cushitic languages" cushitic []]
- ["cym" "Welsh" welsh []]
+ [[["bad" "Banda languages" banda []]
+ ["bai" "Bamileke languages" bamileke []]
+ ["bak" "Bashkir" bashkir []]
+ ["bal" "Baluchi" baluchi []]
+ ["bam" "Bambara" bambara []]
+ ["ban" "Balinese" balinese []]
+ ["bas" "Basa" basa []]
+ ["bat" "Baltic languages" baltic []]
+ ["bej" "Beja; Bedawiyet" beja []]
+ ["bel" "Belarusian" belarusian []]
+ ["bem" "Bemba" bemba []]
+ ["ben" "Bengali" bengali []]
+ ["ber" "Berber languages" berber []]
+ ["bho" "Bhojpuri" bhojpuri []]
+ ["bih" "Bihari languages" bihari []]
+ ["bik" "Bikol" bikol []]
+ ["bin" "Bini; Edo" bini [[edo]]]
+ ["bis" "Bislama" bislama []]
+ ["bla" "Siksika" siksika []]
+ ["bnt" "Bantu languages" bantu []]
+ ["bod" "Tibetan" tibetan []]
+ ["bos" "Bosnian" bosnian []]
+ ["bra" "Braj" braj []]
+ ["bre" "Breton" breton []]
+ ["btk" "Batak languages" batak []]
+ ["bua" "Buriat" buriat []]
+ ["bug" "Buginese" buginese []]
+ ["bul" "Bulgarian" bulgarian []]
+ ["byn" "Blin; Bilin" blin [[bilin]]]]]
+
+ [[["cad" "Caddo" caddo []]
+ ["cai" "Central American Indian languages" central_american_indian []]
+ ["car" "Galibi Carib" galibi_carib []]
+ ["cat" "Catalan; Valencian" catalan [[valencian]]]
+ ["cau" "Caucasian languages" caucasian []]
+ ["ceb" "Cebuano" cebuano []]
+ ["cel" "Celtic languages" celtic []]
+ ["ces" "Czech" czech []]
+ ["cha" "Chamorro" chamorro []]
+ ["chb" "Chibcha" chibcha []]
+ ["che" "Chechen" chechen []]
+ ["chg" "Chagatai" chagatai []]
+ ["chk" "Chuukese" chuukese []]
+ ["chm" "Mari" mari []]
+ ["chn" "Chinook jargon" chinook []]
+ ["cho" "Choctaw" choctaw []]
+ ["chp" "Chipewyan; Dene Suline" chipewyan []]
+ ["chr" "Cherokee" cherokee []]
+ ["chu" "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic" church_slavic [[old_slavonic] [church_slavonic] [old_bulgarian] [old_church_slavonic]]]
+ ["chv" "Chuvash" chuvash []]
+ ["chy" "Cheyenne" cheyenne []]
+ ["cmc" "Chamic languages" chamic []]
+ ["cnr" "Montenegrin" montenegrin []]
+ ["cop" "Coptic" coptic []]
+ ["cor" "Cornish" cornish []]
+ ["cos" "Corsican" corsican []]
+ ["cpe" "Creoles and pidgins, English based" creoles_and_pidgins/english []]
+ ["cpf" "Creoles and pidgins, French-based" creoles_and_pidgins/french []]
+ ["cpp" "Creoles and pidgins, Portuguese-based" creoles_and_pidgins/portuguese []]
+ ["cre" "Cree" cree []]
+ ["crh" "Crimean Tatar; Crimean Turkish" crimean []]
+ ["crp" "Creoles and pidgins" creoles_and_pidgins []]
+ ["csb" "Kashubian" kashubian []]
+ ["cus" "Cushitic languages" cushitic []]
+ ["cym" "Welsh" welsh []]]]
- ["dak" "Dakota" dakota []]
- ["dan" "Danish" danish []]
- ["dar" "Dargwa" dargwa []]
- ["day" "Land Dayak languages" land_dayak []]
- ["del" "Delaware" delaware []]
- ["den" "Slave (Athapascan)" slavey []]
- ["deu" "German" german []]
- ["dgr" "Dogrib" dogrib []]
- ["din" "Dinka" dinka []]
- ["div" "Divehi; Dhivehi; Maldivian" dhivehi [[maldivian]]]
- ["doi" "Dogri" dogri []]
- ["dra" "Dravidian languages" dravidian []]
- ["dsb" "Lower Sorbian" lower_sorbian []]
- ["dua" "Duala" duala []]
- ["dum" "Middle Dutch (ca. 1050–1350)" middle_dutch []]
- ["dyu" "Dyula" dyula []]
- ["dzo" "Dzongkha" dzongkha []]
-
- ["efi" "Efik" efik []]
- ["egy" "Ancient Egyptian" egyptian []]
- ["eka" "Ekajuk" ekajuk []]
- ["ell" "Modern Greek (1453–)" greek []]
- ["elx" "Elamite" elamite []]
- ["eng" "English" english []]
- ["enm" "Middle English (1100–1500)" middle_english []]
- ["epo" "Esperanto" esperanto []]
- ["est" "Estonian" estonian []]
- ["eus" "Basque" basque []]
- ["ewe" "Ewe" ewe []]
- ["ewo" "Ewondo" ewondo []]
-
- ["fan" "Fang" fang []]
- ["fao" "Faroese" faroese []]
- ["fas" "Persian" persian []]
- ["fat" "Fanti" fanti []]
- ["fij" "Fijian" fijian []]
- ["fil" "Filipino; Pilipino" filipino []]
- ["fin" "Finnish" finnish []]
- ["fiu" "Finno-Ugrian languages" finno_ugrian []]
- ["fon" "Fon" fon []]
- ["fra" "French" french []]
- ["frm" "Middle French (ca. 1400–1600)" middle_french []]
- ["fro" "Old French (ca. 842–1400)" old_french []]
- ["frr" "Northern Frisian" northern_frisian []]
- ["frs" "Eastern Frisian" eastern_frisian []]
- ["fry" "Western Frisian" western_frisian []]
- ["ful" "Fulah" fulah []]
- ["fur" "Friulian" friulian []]
-
- ["gaa" "Ga" ga []]
- ["gay" "Gayo" gayo []]
- ["gba" "Gbaya" gbaya []]
- ["gem" "Germanic languages" germanic []]
- ["gez" "Geez" geez []]
- ["gil" "Gilbertese" gilbertese []]
- ["gla" "Gaelic; Scottish Gaelic" gaelic []]
- ["gle" "Irish" irish []]
- ["glg" "Galician" galician []]
- ["glv" "Manx" manx []]
- ["gmh" "Middle High German (ca. 1050–1500)" middle_high_german []]
- ["goh" "Old High German (ca. 750–1050)" old_high_german []]
- ["gon" "Gondi" gondi []]
- ["gor" "Gorontalo" gorontalo []]
- ["got" "Gothic" gothic []]
- ["grb" "Grebo" grebo []]
- ["grc" "Ancient Greek (to 1453)" ancient_greek []]
- ["grn" "Guarani" guarani []]
- ["gsw" "Swiss German; Alemannic; Alsatian" swiss_german [[alemannic] [alsatian]]]
- ["guj" "Gujarati" gujarati []]
- ["gwi" "Gwich'in" gwich'in []]
-
- ["hai" "Haida" haida []]
- ["hat" "Haitian; Haitian Creole" haitian []]
- ["hau" "Hausa" hausa []]
- ["haw" "Hawaiian" hawaiian []]
- ["heb" "Hebrew" hebrew []]
- ["her" "Herero" herero []]
- ["hil" "Hiligaynon" hiligaynon []]
- ["him" "Himachali languages; Pahari languages" himachali []]
- ["hin" "Hindi" hindi []]
- ["hit" "Hittite" hittite []]
- ["hmn" "Hmong; Mong" hmong []]
- ["hmo" "Hiri Motu" hiri_motu []]
- ["hrv" "Croatian" croatian []]
- ["hsb" "Upper Sorbian" upper_sorbian []]
- ["hun" "Hungarian" hungarian []]
- ["hup" "Hupa" hupa []]
- ["hye" "Armenian" armenian []]
-
- ["iba" "Iban" iban []]
- ["ibo" "Igbo" igbo []]
- ["ido" "Ido" ido []]
- ["iii" "Sichuan Yi; Nuosu" sichuan_yi [[nuosu]]]
- ["ijo" "Ijo languages" ijo []]
- ["iku" "Inuktitut" inuktitut []]
- ["ile" "Interlingue; Occidental" interlingue []]
- ["ilo" "Iloko" iloko []]
- ["ina" "Interlingua (International Auxiliary Language Association)" interlingua []]
- ["inc" "Indic languages" indic []]
- ["ind" "Indonesian" indonesian []]
- ["ine" "Indo-European languages" indo_european []]
- ["inh" "Ingush" ingush []]
- ["ipk" "Inupiaq" inupiaq []]
- ["ira" "Iranian languages" iranian []]
- ["iro" "Iroquoian languages" iroquoian []]
- ["isl" "Icelandic" icelandic []]
- ["ita" "Italian" italian []]
-
- ["jav" "Javanese" javanese []]
- ["jbo" "Lojban" lojban []]
- ["jpn" "Japanese" japanese []]
- ["jpr" "Judeo-Persian" judeo_persian []]
- ["jrb" "Judeo-Arabic" judeo_arabic []]
-
- ["kaa" "Kara-Kalpak" kara_kalpak []]
- ["kab" "Kabyle" kabyle []]
- ["kac" "Kachin; Jingpho" kachin [[jingpho]]]
- ["kal" "Kalaallisut; Greenlandic" kalaallisut [[greenlandic]]]
- ["kam" "Kamba" kamba []]
- ["kan" "Kannada" kannada []]
- ["kar" "Karen languages" karen []]
- ["kas" "Kashmiri" kashmiri []]
- ["kat" "Georgian" georgian []]
- ["kau" "Kanuri" kanuri []]
- ["kaw" "Kawi" kawi []]
- ["kaz" "Kazakh" kazakh []]
- ["kbd" "Kabardian" kabardian []]
- ["kha" "Khasi" khasi []]
- ["khi" "Khoisan languages" khoisan []]
- ["khm" "Central Khmer" central_khmer []]
- ["kho" "Khotanese; Sakan" khotanese [[sakan]]]
- ["kik" "Kikuyu; Gikuyu" gikuyu []]
- ["kin" "Kinyarwanda" kinyarwanda []]
- ["kir" "Kirghiz; Kyrgyz" kyrgyz []]
- ["kmb" "Kimbundu" kimbundu []]
- ["kok" "Konkani" konkani []]
- ["kom" "Komi" komi []]
- ["kon" "Kongo" kongo []]
- ["kor" "Korean" korean []]
- ["kos" "Kosraean" kosraean []]
- ["kpe" "Kpelle" kpelle []]
- ["krc" "Karachay-Balkar" karachay_balkar []]
- ["krl" "Karelian" karelian []]
- ["kro" "Kru languages" kru []]
- ["kru" "Kurukh" kurukh []]
- ["kua" "Kuanyama; Kwanyama" kwanyama []]
- ["kum" "Kumyk" kumyk []]
- ["kur" "Kurdish" kurdish []]
- ["kut" "Kutenai" kutenai []]
-
- ["lad" "Ladino" ladino []]
- ["lah" "Lahnda" lahnda []]
- ["lam" "Lamba" lamba []]
- ["lao" "Lao" lao []]
- ["lat" "Latin" latin []]
- ["lav" "Latvian" latvian []]
- ["lez" "Lezghian" lezghian []]
- ["lim" "Limburgan; Limburger; Limburgish" limburgan []]
- ["lin" "Lingala" lingala []]
- ["lit" "Lithuanian" lithuanian []]
- ["lol" "Mongo" mongo []]
- ["loz" "Lozi" lozi []]
- ["ltz" "Luxembourgish; Letzeburgesch" luxembourgish []]
- ["lua" "Luba-Lulua" luba_lulua []]
- ["lub" "Luba-Katanga" luba_katanga []]
- ["lug" "Ganda" ganda []]
- ["lui" "Luiseno" luiseno []]
- ["lun" "Lunda" lunda []]
- ["luo" "Luo (Kenya and Tanzania)" luo []]
- ["lus" "Lushai" lushai []]
-
- ["mad" "Madurese" madurese []]
- ["mag" "Magahi" magahi []]
- ["mah" "Marshallese" marshallese []]
- ["mai" "Maithili" maithili []]
- ["mak" "Makasar" makasar []]
- ["mal" "Malayalam" malayalam []]
- ["man" "Mandingo" mandingo []]
- ["map" "Austronesian languages" austronesian []]
- ["mar" "Marathi" marathi []]
- ["mas" "Masai" masai []]
- ["mdf" "Moksha" moksha []]
- ["mdr" "Mandar" mandar []]
- ["men" "Mende" mende []]
- ["mga" "Middle Irish (900–1200)" middle_irish []]
- ["mic" "Mi'kmaq; Micmac" mi'kmaq [[micmac]]]
- ["min" "Minangkabau" minangkabau []]
- ["mkd" "Macedonian" macedonian []]
- ["mkh" "Mon-Khmer languages" mon_khmer []]
- ["mlg" "Malagasy" malagasy []]
- ["mlt" "Maltese" maltese []]
- ["mnc" "Manchu" manchu []]
- ["mni" "Manipuri" manipuri []]
- ["mno" "Manobo languages" manobo []]
- ["moh" "Mohawk" mohawk []]
- ["mon" "Mongolian" mongolian []]
- ["mos" "Mossi" mossi []]
- ["mri" "Maori" maori []]
- ["msa" "Malay" malay []]
- ["mun" "Munda languages" munda []]
- ["mus" "Creek" creek []]
- ["mwl" "Mirandese" mirandese []]
- ["mwr" "Marwari" marwari []]
- ["mya" "Burmese" burmese []]
- ["myn" "Mayan languages" mayan []]
- ["myv" "Erzya" erzya []]
-
- ["nah" "Nahuatl languages" nahuatl []]
- ["nai" "North American Indian languages" north_american_indian []]
- ["nap" "Neapolitan" neapolitan []]
- ["nau" "Nauru" nauru []]
- ["nav" "Navajo; Navaho" navajo []]
- ["nbl" "South Ndebele" south_ndebele []]
- ["nde" "North Ndebele" north_ndebele []]
- ["ndo" "Ndonga" ndonga []]
- ["nds" "Low German; Low Saxon" low_german []]
- ["nep" "Nepali" nepali []]
- ["new" "Nepal Bhasa; Newari" newari [[nepal_bhasa]]]
- ["nia" "Nias" nias []]
- ["nic" "Niger-Kordofanian languages" niger_kordofanian []]
- ["niu" "Niuean" niuean []]
- ["nld" "Dutch; Flemish" dutch [[flemish]]]
- ["nno" "Norwegian Nynorsk" nynorsk []]
- ["nob" "Norwegian Bokmål" bokmal []]
- ["nog" "Nogai" nogai []]
- ["non" "Old Norse" old_norse []]
- ["nor" "Norwegian" norwegian []]
- ["nqo" "N'Ko" n'ko []]
- ["nso" "Pedi; Sepedi; Northern Sotho" northern_sotho [[pedi] [sepedi]]]
- ["nub" "Nubian languages" nubian []]
- ["nwc" "Classical Newari; Old Newari; Classical Nepal Bhasa" old_newari [[classical_newari] [classical_nepal_bhasa]]]
- ["nya" "Chichewa; Chewa; Nyanja" nyanja [[chichewa] [chewa]]]
- ["nym" "Nyamwezi" nyamwezi []]
- ["nyn" "Nyankole" nyankole []]
- ["nyo" "Nyoro" nyoro []]
- ["nzi" "Nzima" nzima []]
-
- ["oci" "Occitan (post 1500); Provençal" occitan [[provencal]]]
- ["oji" "Ojibwa" ojibwa []]
- ["ori" "Oriya" oriya []]
- ["orm" "Oromo" oromo []]
- ["osa" "Osage" osage []]
- ["oss" "Ossetian; Ossetic" ossetic []]
- ["ota" "Ottoman Turkish (1500–1928)" ottoman_turkish []]
- ["oto" "Otomian languages" otomian []]
-
- ["paa" "Papuan languages" papuan []]
- ["pag" "Pangasinan" pangasinan []]
- ["pal" "Pahlavi" pahlavi []]
- ["pam" "Pampanga; Kapampangan" pampanga [[kapampangan]]]
- ["pan" "Panjabi; Punjabi" punjabi []]
- ["pap" "Papiamento" papiamento []]
- ["pau" "Palauan" palauan []]
- ["peo" "Old Persian (ca. 600–400 B.C.)" old_persian []]
- ["phi" "Philippine languages" philippine []]
- ["phn" "Phoenician" phoenician []]
- ["pli" "Pali" pali []]
- ["pol" "Polish" polish []]
- ["pon" "Pohnpeian" pohnpeian []]
- ["por" "Portuguese" portuguese []]
- ["pra" "Prakrit languages" prakrit []]
- ["pro" "Old Provençal (to 1500); Old Occitan (to 1500)" old_provencal []]
- ["pus" "Pushto; Pashto" pashto []]
-
- ["que" "Quechua" quechua []]
-
- ["raj" "Rajasthani" rajasthani []]
- ["rap" "Rapanui" rapanui []]
- ["rar" "Rarotongan; Cook Islands Maori" rarotongan [[cook_islands_maori]]]
- ["roa" "Romance languages" romance []]
- ["roh" "Romansh" romansh []]
- ["rom" "Romany" romany []]
- ["ron" "Romanian; Moldavian; Moldovan" romanian [[moldavian] [moldovan]]]
- ["run" "Rundi" rundi []]
- ["rup" "Aromanian; Arumanian; Macedo-Romanian" aromanian [[arumanian] [macedo_romanian]]]
- ["rus" "Russian" russian []]
-
- ["sad" "Sandawe" sandawe []]
- ["sag" "Sango" sango []]
- ["sah" "Yakut" yakut []]
- ["sai" "South American Indian (Other)" south_american_indian []]
- ["sal" "Salishan languages" salishan []]
- ["sam" "Samaritan Aramaic" samaritan_aramaic []]
- ["san" "Sanskrit" sanskrit []]
- ["sas" "Sasak" sasak []]
- ["sat" "Santali" santali []]
- ["scn" "Sicilian" sicilian []]
- ["sco" "Scots" scots []]
- ["sel" "Selkup" selkup []]
- ["sem" "Semitic languages" semitic []]
- ["sga" "Old Irish (to 900)" old_irish []]
- ["sgn" "Sign Languages" sign []]
- ["shn" "Shan" shan []]
- ["sid" "Sidamo" sidamo []]
- ["sin" "Sinhala; Sinhalese" sinhalese []]
- ["sio" "Siouan languages" siouan []]
- ["sit" "Sino-Tibetan languages" sino_tibetan []]
- ["sla" "Slavic languages" slavic []]
- ["slk" "Slovak" slovak []]
- ["slv" "Slovenian" slovenian []]
- ["sma" "Southern Sami" southern_sami []]
- ["sme" "Northern Sami" northern_sami []]
- ["smi" "Sami languages" sami []]
- ["smj" "Lule Sami" lule []]
- ["smn" "Inari Sami" inari []]
- ["smo" "Samoan" samoan []]
- ["sms" "Skolt Sami" skolt_sami []]
- ["sna" "Shona" shona []]
- ["snd" "Sindhi" sindhi []]
- ["snk" "Soninke" soninke []]
- ["sog" "Sogdian" sogdian []]
- ["som" "Somali" somali []]
- ["son" "Songhai languages" songhai []]
- ["sot" "Southern Sotho" southern_sotho []]
- ["spa" "Spanish; Castilian" spanish [[castilian]]]
- ["sqi" "Albanian" albanian []]
- ["srd" "Sardinian" sardinian []]
- ["srn" "Sranan Tongo" sranan_tongo []]
- ["srp" "Serbian" serbian []]
- ["srr" "Serer" serer []]
- ["ssa" "Nilo-Saharan languages" nilo_saharan []]
- ["ssw" "Swati" swati []]
- ["suk" "Sukuma" sukuma []]
- ["sun" "Sundanese" sundanese []]
- ["sus" "Susu" susu []]
- ["sux" "Sumerian" sumerian []]
- ["swa" "Swahili" swahili []]
- ["swe" "Swedish" swedish []]
- ["syc" "Classical Syriac" classical_syriac []]
- ["syr" "Syriac" syriac []]
-
- ["tah" "Tahitian" tahitian []]
- ["tai" "Tai languages" tai []]
- ["tam" "Tamil" tamil []]
- ["tat" "Tatar" tatar []]
- ["tel" "Telugu" telugu []]
- ["tem" "Timne" timne []]
- ["ter" "Tereno" tereno []]
- ["tet" "Tetum" tetum []]
- ["tgk" "Tajik" tajik []]
- ["tgl" "Tagalog" tagalog []]
- ["tha" "Thai" thai []]
- ["tig" "Tigre" tigre []]
- ["tir" "Tigrinya" tigrinya []]
- ["tiv" "Tiv" tiv []]
- ["tkl" "Tokelau" tokelau []]
- ["tlh" "Klingon; tlhIngan-Hol" klingon []]
- ["tli" "Tlingit" tlingit []]
- ["tmh" "Tamashek" tamashek []]
- ["tog" "Tonga (Nyasa)" tonga []]
- ["ton" "Tonga (Tonga Islands)" tongan []]
- ["tpi" "Tok Pisin" tok_pisin []]
- ["tsi" "Tsimshian" tsimshian []]
- ["tsn" "Tswana" tswana []]
- ["tso" "Tsonga" tsonga []]
- ["tuk" "Turkmen" turkmen []]
- ["tum" "Tumbuka" tumbuka []]
- ["tup" "Tupi languages" tupi []]
- ["tur" "Turkish" turkish []]
- ["tut" "Altaic languages" altaic []]
- ["tvl" "Tuvalu" tuvalu []]
- ["twi" "Twi" twi []]
- ["tyv" "Tuvinian" tuvinian []]
-
- ["udm" "Udmurt" udmurt []]
- ["uga" "Ugaritic" ugaritic []]
- ["uig" "Uighur; Uyghur" uyghur []]
- ["ukr" "Ukrainian" ukrainian []]
- ["umb" "Umbundu" umbundu []]
- ["urd" "Urdu" urdu []]
- ["uzb" "Uzbek" uzbek []]
-
- ["vai" "Vai" vai []]
- ["ven" "Venda" venda []]
- ["vie" "Vietnamese" vietnamese []]
- ["vol" "Volapük" volapük []]
- ["vot" "Votic" votic []]
-
- ["wak" "Wakashan languages" wakashan []]
- ["wal" "Wolaitta; Wolaytta" walamo []]
- ["war" "Waray" waray []]
- ["was" "Washo" washo []]
- ["wen" "Sorbian languages" sorbian []]
- ["wln" "Walloon" walloon []]
- ["wol" "Wolof" wolof []]
-
- ["xal" "Kalmyk; Oirat" kalmyk [[oirat]]]
- ["xho" "Xhosa" xhosa []]
-
- ["yao" "Yao" yao []]
- ["yap" "Yapese" yapese []]
- ["yid" "Yiddish" yiddish []]
- ["yor" "Yoruba" yoruba []]
- ["ypk" "Yupik languages" yupik []]
-
- ["zap" "Zapotec" zapotec []]
- ["zbl" "Blissymbols; Blissymbolics; Bliss" blissymbols []]
- ["zen" "Zenaga" zenaga []]
- ["zgh" "Standard Moroccan Tamazight" standard_moroccan_tamazight []]
- ["zha" "Zhuang; Chuang" zhuang []]
- ["zho" "Chinese" chinese []]
- ["znd" "Zande languages" zande []]
- ["zul" "Zulu" zulu []]
- ["zun" "Zuni" zuni []]
- ["zza" "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki" zaza [[dimili] [dimli] [kirdki] [kirmanjki] [zazaki]]]
- )
+ [[["dak" "Dakota" dakota []]
+ ["dan" "Danish" danish []]
+ ["dar" "Dargwa" dargwa []]
+ ["day" "Land Dayak languages" land_dayak []]
+ ["del" "Delaware" delaware []]
+ ["den" "Slave (Athapascan)" slavey []]
+ ["deu" "German" german []]
+ ["dgr" "Dogrib" dogrib []]
+ ["din" "Dinka" dinka []]
+ ["div" "Divehi; Dhivehi; Maldivian" dhivehi [[maldivian]]]
+ ["doi" "Dogri" dogri []]
+ ["dra" "Dravidian languages" dravidian []]
+ ["dsb" "Lower Sorbian" lower_sorbian []]
+ ["dua" "Duala" duala []]
+ ["dum" "Middle Dutch (ca. 1050–1350)" middle_dutch []]
+ ["dyu" "Dyula" dyula []]
+ ["dzo" "Dzongkha" dzongkha []]]]
+
+ [[["efi" "Efik" efik []]
+ ["egy" "Ancient Egyptian" egyptian []]
+ ["eka" "Ekajuk" ekajuk []]
+ ["ell" "Modern Greek (1453–)" greek []]
+ ["elx" "Elamite" elamite []]
+ ["eng" "English" english []]
+ ["enm" "Middle English (1100–1500)" middle_english []]
+ ["epo" "Esperanto" esperanto []]
+ ["est" "Estonian" estonian []]
+ ["eus" "Basque" basque []]
+ ["ewe" "Ewe" ewe []]
+ ["ewo" "Ewondo" ewondo []]]]
+
+ [[["fan" "Fang" fang []]
+ ["fao" "Faroese" faroese []]
+ ["fas" "Persian" persian []]
+ ["fat" "Fanti" fanti []]
+ ["fij" "Fijian" fijian []]
+ ["fil" "Filipino; Pilipino" filipino []]
+ ["fin" "Finnish" finnish []]
+ ["fiu" "Finno-Ugrian languages" finno_ugrian []]
+ ["fon" "Fon" fon []]
+ ["fra" "French" french []]
+ ["frm" "Middle French (ca. 1400–1600)" middle_french []]
+ ["fro" "Old French (ca. 842–1400)" old_french []]
+ ["frr" "Northern Frisian" northern_frisian []]
+ ["frs" "Eastern Frisian" eastern_frisian []]
+ ["fry" "Western Frisian" western_frisian []]
+ ["ful" "Fulah" fulah []]
+ ["fur" "Friulian" friulian []]]]
+
+ [[["gaa" "Ga" ga []]
+ ["gay" "Gayo" gayo []]
+ ["gba" "Gbaya" gbaya []]
+ ["gem" "Germanic languages" germanic []]
+ ["gez" "Geez" geez []]
+ ["gil" "Gilbertese" gilbertese []]
+ ["gla" "Gaelic; Scottish Gaelic" gaelic []]
+ ["gle" "Irish" irish []]
+ ["glg" "Galician" galician []]
+ ["glv" "Manx" manx []]
+ ["gmh" "Middle High German (ca. 1050–1500)" middle_high_german []]
+ ["goh" "Old High German (ca. 750–1050)" old_high_german []]
+ ["gon" "Gondi" gondi []]
+ ["gor" "Gorontalo" gorontalo []]
+ ["got" "Gothic" gothic []]
+ ["grb" "Grebo" grebo []]
+ ["grc" "Ancient Greek (to 1453)" ancient_greek []]
+ ["grn" "Guarani" guarani []]
+ ["gsw" "Swiss German; Alemannic; Alsatian" swiss_german [[alemannic] [alsatian]]]
+ ["guj" "Gujarati" gujarati []]
+ ["gwi" "Gwich'in" gwich'in []]]]
+
+ [[["hai" "Haida" haida []]
+ ["hat" "Haitian; Haitian Creole" haitian []]
+ ["hau" "Hausa" hausa []]
+ ["haw" "Hawaiian" hawaiian []]
+ ["heb" "Hebrew" hebrew []]
+ ["her" "Herero" herero []]
+ ["hil" "Hiligaynon" hiligaynon []]
+ ["him" "Himachali languages; Pahari languages" himachali []]
+ ["hin" "Hindi" hindi []]
+ ["hit" "Hittite" hittite []]
+ ["hmn" "Hmong; Mong" hmong []]
+ ["hmo" "Hiri Motu" hiri_motu []]
+ ["hrv" "Croatian" croatian []]
+ ["hsb" "Upper Sorbian" upper_sorbian []]
+ ["hun" "Hungarian" hungarian []]
+ ["hup" "Hupa" hupa []]
+ ["hye" "Armenian" armenian []]]]
+
+ [[["iba" "Iban" iban []]
+ ["ibo" "Igbo" igbo []]
+ ["ido" "Ido" ido []]
+ ["iii" "Sichuan Yi; Nuosu" sichuan_yi [[nuosu]]]
+ ["ijo" "Ijo languages" ijo []]
+ ["iku" "Inuktitut" inuktitut []]
+ ["ile" "Interlingue; Occidental" interlingue []]
+ ["ilo" "Iloko" iloko []]
+ ["ina" "Interlingua (International Auxiliary Language Association)" interlingua []]
+ ["inc" "Indic languages" indic []]
+ ["ind" "Indonesian" indonesian []]
+ ["ine" "Indo-European languages" indo_european []]
+ ["inh" "Ingush" ingush []]
+ ["ipk" "Inupiaq" inupiaq []]
+ ["ira" "Iranian languages" iranian []]
+ ["iro" "Iroquoian languages" iroquoian []]
+ ["isl" "Icelandic" icelandic []]
+ ["ita" "Italian" italian []]]]
+
+ [[["jav" "Javanese" javanese []]
+ ["jbo" "Lojban" lojban []]
+ ["jpn" "Japanese" japanese []]
+ ["jpr" "Judeo-Persian" judeo_persian []]
+ ["jrb" "Judeo-Arabic" judeo_arabic []]]]
+
+ [[["kaa" "Kara-Kalpak" kara_kalpak []]
+ ["kab" "Kabyle" kabyle []]
+ ["kac" "Kachin; Jingpho" kachin [[jingpho]]]
+ ["kal" "Kalaallisut; Greenlandic" kalaallisut [[greenlandic]]]
+ ["kam" "Kamba" kamba []]
+ ["kan" "Kannada" kannada []]
+ ["kar" "Karen languages" karen []]
+ ["kas" "Kashmiri" kashmiri []]
+ ["kat" "Georgian" georgian []]
+ ["kau" "Kanuri" kanuri []]
+ ["kaw" "Kawi" kawi []]
+ ["kaz" "Kazakh" kazakh []]
+ ["kbd" "Kabardian" kabardian []]
+ ["kha" "Khasi" khasi []]
+ ["khi" "Khoisan languages" khoisan []]
+ ["khm" "Central Khmer" central_khmer []]
+ ["kho" "Khotanese; Sakan" khotanese [[sakan]]]
+ ["kik" "Kikuyu; Gikuyu" gikuyu []]
+ ["kin" "Kinyarwanda" kinyarwanda []]
+ ["kir" "Kirghiz; Kyrgyz" kyrgyz []]
+ ["kmb" "Kimbundu" kimbundu []]
+ ["kok" "Konkani" konkani []]
+ ["kom" "Komi" komi []]
+ ["kon" "Kongo" kongo []]
+ ["kor" "Korean" korean []]
+ ["kos" "Kosraean" kosraean []]
+ ["kpe" "Kpelle" kpelle []]
+ ["krc" "Karachay-Balkar" karachay_balkar []]
+ ["krl" "Karelian" karelian []]
+ ["kro" "Kru languages" kru []]
+ ["kru" "Kurukh" kurukh []]
+ ["kua" "Kuanyama; Kwanyama" kwanyama []]
+ ["kum" "Kumyk" kumyk []]
+ ["kur" "Kurdish" kurdish []]
+ ["kut" "Kutenai" kutenai []]]]
+
+ [[["lad" "Ladino" ladino []]
+ ["lah" "Lahnda" lahnda []]
+ ["lam" "Lamba" lamba []]
+ ["lao" "Lao" lao []]
+ ["lat" "Latin" latin []]
+ ["lav" "Latvian" latvian []]
+ ["lez" "Lezghian" lezghian []]
+ ["lim" "Limburgan; Limburger; Limburgish" limburgan []]
+ ["lin" "Lingala" lingala []]
+ ["lit" "Lithuanian" lithuanian []]
+ ["lol" "Mongo" mongo []]
+ ["loz" "Lozi" lozi []]
+ ["ltz" "Luxembourgish; Letzeburgesch" luxembourgish []]
+ ["lua" "Luba-Lulua" luba_lulua []]
+ ["lub" "Luba-Katanga" luba_katanga []]
+ ["lug" "Ganda" ganda []]
+ ["lui" "Luiseno" luiseno []]
+ ["lun" "Lunda" lunda []]
+ ["luo" "Luo (Kenya and Tanzania)" luo []]
+ ["lus" "Lushai" lushai []]]]
+
+ [[["mad" "Madurese" madurese []]
+ ["mag" "Magahi" magahi []]
+ ["mah" "Marshallese" marshallese []]
+ ["mai" "Maithili" maithili []]
+ ["mak" "Makasar" makasar []]
+ ["mal" "Malayalam" malayalam []]
+ ["man" "Mandingo" mandingo []]
+ ["map" "Austronesian languages" austronesian []]
+ ["mar" "Marathi" marathi []]
+ ["mas" "Masai" masai []]
+ ["mdf" "Moksha" moksha []]
+ ["mdr" "Mandar" mandar []]
+ ["men" "Mende" mende []]
+ ["mga" "Middle Irish (900–1200)" middle_irish []]
+ ["mic" "Mi'kmaq; Micmac" mi'kmaq [[micmac]]]
+ ["min" "Minangkabau" minangkabau []]
+ ["mkd" "Macedonian" macedonian []]
+ ["mkh" "Mon-Khmer languages" mon_khmer []]
+ ["mlg" "Malagasy" malagasy []]
+ ["mlt" "Maltese" maltese []]
+ ["mnc" "Manchu" manchu []]
+ ["mni" "Manipuri" manipuri []]
+ ["mno" "Manobo languages" manobo []]
+ ["moh" "Mohawk" mohawk []]
+ ["mon" "Mongolian" mongolian []]
+ ["mos" "Mossi" mossi []]
+ ["mri" "Maori" maori []]
+ ["msa" "Malay" malay []]
+ ["mun" "Munda languages" munda []]
+ ["mus" "Creek" creek []]
+ ["mwl" "Mirandese" mirandese []]
+ ["mwr" "Marwari" marwari []]
+ ["mya" "Burmese" burmese []]
+ ["myn" "Mayan languages" mayan []]
+ ["myv" "Erzya" erzya []]]]
+
+ [[["nah" "Nahuatl languages" nahuatl []]
+ ["nai" "North American Indian languages" north_american_indian []]
+ ["nap" "Neapolitan" neapolitan []]
+ ["nau" "Nauru" nauru []]
+ ["nav" "Navajo; Navaho" navajo []]
+ ["nbl" "South Ndebele" south_ndebele []]
+ ["nde" "North Ndebele" north_ndebele []]
+ ["ndo" "Ndonga" ndonga []]
+ ["nds" "Low German; Low Saxon" low_german []]
+ ["nep" "Nepali" nepali []]
+ ["new" "Nepal Bhasa; Newari" newari [[nepal_bhasa]]]
+ ["nia" "Nias" nias []]
+ ["nic" "Niger-Kordofanian languages" niger_kordofanian []]
+ ["niu" "Niuean" niuean []]
+ ["nld" "Dutch; Flemish" dutch [[flemish]]]
+ ["nno" "Norwegian Nynorsk" nynorsk []]
+ ["nob" "Norwegian Bokmål" bokmal []]
+ ["nog" "Nogai" nogai []]
+ ["non" "Old Norse" old_norse []]
+ ["nor" "Norwegian" norwegian []]
+ ["nqo" "N'Ko" n'ko []]
+ ["nso" "Pedi; Sepedi; Northern Sotho" northern_sotho [[pedi] [sepedi]]]
+ ["nub" "Nubian languages" nubian []]
+ ["nwc" "Classical Newari; Old Newari; Classical Nepal Bhasa" old_newari [[classical_newari] [classical_nepal_bhasa]]]
+ ["nya" "Chichewa; Chewa; Nyanja" nyanja [[chichewa] [chewa]]]
+ ["nym" "Nyamwezi" nyamwezi []]
+ ["nyn" "Nyankole" nyankole []]
+ ["nyo" "Nyoro" nyoro []]
+ ["nzi" "Nzima" nzima []]]]
+
+ [[["oci" "Occitan (post 1500); Provençal" occitan [[provencal]]]
+ ["oji" "Ojibwa" ojibwa []]
+ ["ori" "Oriya" oriya []]
+ ["orm" "Oromo" oromo []]
+ ["osa" "Osage" osage []]
+ ["oss" "Ossetian; Ossetic" ossetic []]
+ ["ota" "Ottoman Turkish (1500–1928)" ottoman_turkish []]
+ ["oto" "Otomian languages" otomian []]]]
+
+ [[["paa" "Papuan languages" papuan []]
+ ["pag" "Pangasinan" pangasinan []]
+ ["pal" "Pahlavi" pahlavi []]
+ ["pam" "Pampanga; Kapampangan" pampanga [[kapampangan]]]
+ ["pan" "Panjabi; Punjabi" punjabi []]
+ ["pap" "Papiamento" papiamento []]
+ ["pau" "Palauan" palauan []]
+ ["peo" "Old Persian (ca. 600–400 B.C.)" old_persian []]
+ ["phi" "Philippine languages" philippine []]
+ ["phn" "Phoenician" phoenician []]
+ ["pli" "Pali" pali []]
+ ["pol" "Polish" polish []]
+ ["pon" "Pohnpeian" pohnpeian []]
+ ["por" "Portuguese" portuguese []]
+ ["pra" "Prakrit languages" prakrit []]
+ ["pro" "Old Provençal (to 1500); Old Occitan (to 1500)" old_provencal []]
+ ["pus" "Pushto; Pashto" pashto []]]]
+
+ [[["que" "Quechua" quechua []]]]
+
+ [[["raj" "Rajasthani" rajasthani []]
+ ["rap" "Rapanui" rapanui []]
+ ["rar" "Rarotongan; Cook Islands Maori" rarotongan [[cook_islands_maori]]]
+ ["roa" "Romance languages" romance []]
+ ["roh" "Romansh" romansh []]
+ ["rom" "Romany" romany []]
+ ["ron" "Romanian; Moldavian; Moldovan" romanian [[moldavian] [moldovan]]]
+ ["run" "Rundi" rundi []]
+ ["rup" "Aromanian; Arumanian; Macedo-Romanian" aromanian [[arumanian] [macedo_romanian]]]
+ ["rus" "Russian" russian []]]]
+
+ [[["sad" "Sandawe" sandawe []]
+ ["sag" "Sango" sango []]
+ ["sah" "Yakut" yakut []]
+ ["sai" "South American Indian (Other)" south_american_indian []]
+ ["sal" "Salishan languages" salishan []]
+ ["sam" "Samaritan Aramaic" samaritan_aramaic []]
+ ["san" "Sanskrit" sanskrit []]
+ ["sas" "Sasak" sasak []]
+ ["sat" "Santali" santali []]
+ ["scn" "Sicilian" sicilian []]
+ ["sco" "Scots" scots []]
+ ["sel" "Selkup" selkup []]
+ ["sem" "Semitic languages" semitic []]
+ ["sga" "Old Irish (to 900)" old_irish []]
+ ["sgn" "Sign Languages" sign []]
+ ["shn" "Shan" shan []]
+ ["sid" "Sidamo" sidamo []]
+ ["sin" "Sinhala; Sinhalese" sinhalese []]
+ ["sio" "Siouan languages" siouan []]
+ ["sit" "Sino-Tibetan languages" sino_tibetan []]
+ ["sla" "Slavic languages" slavic []]
+ ["slk" "Slovak" slovak []]
+ ["slv" "Slovenian" slovenian []]
+ ["sma" "Southern Sami" southern_sami []]
+ ["sme" "Northern Sami" northern_sami []]
+ ["smi" "Sami languages" sami []]
+ ["smj" "Lule Sami" lule []]
+ ["smn" "Inari Sami" inari []]
+ ["smo" "Samoan" samoan []]
+ ["sms" "Skolt Sami" skolt_sami []]
+ ["sna" "Shona" shona []]
+ ["snd" "Sindhi" sindhi []]
+ ["snk" "Soninke" soninke []]
+ ["sog" "Sogdian" sogdian []]
+ ["som" "Somali" somali []]
+ ["son" "Songhai languages" songhai []]
+ ["sot" "Southern Sotho" southern_sotho []]
+ ["spa" "Spanish; Castilian" spanish [[castilian]]]
+ ["sqi" "Albanian" albanian []]
+ ["srd" "Sardinian" sardinian []]
+ ["srn" "Sranan Tongo" sranan_tongo []]
+ ["srp" "Serbian" serbian []]
+ ["srr" "Serer" serer []]
+ ["ssa" "Nilo-Saharan languages" nilo_saharan []]
+ ["ssw" "Swati" swati []]
+ ["suk" "Sukuma" sukuma []]
+ ["sun" "Sundanese" sundanese []]
+ ["sus" "Susu" susu []]
+ ["sux" "Sumerian" sumerian []]
+ ["swa" "Swahili" swahili []]
+ ["swe" "Swedish" swedish []]
+ ["syc" "Classical Syriac" classical_syriac []]
+ ["syr" "Syriac" syriac []]]]
+
+ [[["tah" "Tahitian" tahitian []]
+ ["tai" "Tai languages" tai []]
+ ["tam" "Tamil" tamil []]
+ ["tat" "Tatar" tatar []]
+ ["tel" "Telugu" telugu []]
+ ["tem" "Timne" timne []]
+ ["ter" "Tereno" tereno []]
+ ["tet" "Tetum" tetum []]
+ ["tgk" "Tajik" tajik []]
+ ["tgl" "Tagalog" tagalog []]
+ ["tha" "Thai" thai []]
+ ["tig" "Tigre" tigre []]
+ ["tir" "Tigrinya" tigrinya []]
+ ["tiv" "Tiv" tiv []]
+ ["tkl" "Tokelau" tokelau []]
+ ["tlh" "Klingon; tlhIngan-Hol" klingon []]
+ ["tli" "Tlingit" tlingit []]
+ ["tmh" "Tamashek" tamashek []]
+ ["tog" "Tonga (Nyasa)" tonga []]
+ ["ton" "Tonga (Tonga Islands)" tongan []]
+ ["tpi" "Tok Pisin" tok_pisin []]
+ ["tsi" "Tsimshian" tsimshian []]
+ ["tsn" "Tswana" tswana []]
+ ["tso" "Tsonga" tsonga []]
+ ["tuk" "Turkmen" turkmen []]
+ ["tum" "Tumbuka" tumbuka []]
+ ["tup" "Tupi languages" tupi []]
+ ["tur" "Turkish" turkish []]
+ ["tut" "Altaic languages" altaic []]
+ ["tvl" "Tuvalu" tuvalu []]
+ ["twi" "Twi" twi []]
+ ["tyv" "Tuvinian" tuvinian []]]]
+
+ [[["udm" "Udmurt" udmurt []]
+ ["uga" "Ugaritic" ugaritic []]
+ ["uig" "Uighur; Uyghur" uyghur []]
+ ["ukr" "Ukrainian" ukrainian []]
+ ["umb" "Umbundu" umbundu []]
+ ["urd" "Urdu" urdu []]
+ ["uzb" "Uzbek" uzbek []]]]
+
+ [[["vai" "Vai" vai []]
+ ["ven" "Venda" venda []]
+ ["vie" "Vietnamese" vietnamese []]
+ ["vol" "Volapük" volapük []]
+ ["vot" "Votic" votic []]]]
+
+ [[["wak" "Wakashan languages" wakashan []]
+ ["wal" "Wolaitta; Wolaytta" walamo []]
+ ["war" "Waray" waray []]
+ ["was" "Washo" washo []]
+ ["wen" "Sorbian languages" sorbian []]
+ ["wln" "Walloon" walloon []]
+ ["wol" "Wolof" wolof []]]]
+
+ [[["xal" "Kalmyk; Oirat" kalmyk [[oirat]]]
+ ["xho" "Xhosa" xhosa []]]]
+
+ [[["yao" "Yao" yao []]
+ ["yap" "Yapese" yapese []]
+ ["yid" "Yiddish" yiddish []]
+ ["yor" "Yoruba" yoruba []]
+ ["ypk" "Yupik languages" yupik []]]]
+
+ [[["zap" "Zapotec" zapotec []]
+ ["zbl" "Blissymbols; Blissymbolics; Bliss" blissymbols []]
+ ["zen" "Zenaga" zenaga []]
+ ["zgh" "Standard Moroccan Tamazight" standard_moroccan_tamazight []]
+ ["zha" "Zhuang; Chuang" zhuang []]
+ ["zho" "Chinese" chinese []]
+ ["znd" "Zande languages" zande []]
+ ["zul" "Zulu" zulu []]
+ ["zun" "Zuni" zuni []]
+ ["zza" "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki" zaza [[dimili] [dimli] [kirdki] [kirmanjki] [zazaki]]]]])
(structure: #export equivalence
(Equivalence Language)
diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux
index 5a7511349..21caf5bae 100644
--- a/stdlib/source/lux/macro.lux
+++ b/stdlib/source/lux/macro.lux
@@ -177,7 +177,7 @@
(do //.monad
[location //.location
output (<func> token)
- #let [_ ("lux io log" ($_ text\compose (name\encode macro_name) " @ " (location.format location)))
+ #let [_ ("lux io log" ($_ text\compose (name\encode macro_name) " " (location.format location)))
_ (list\map (|>> code.format "lux io log")
output)
_ ("lux io log" "")]]
diff --git a/stdlib/source/lux/target/js.lux b/stdlib/source/lux/target/js.lux
index 89f3ed25a..fb0e8948a 100644
--- a/stdlib/source/lux/target/js.lux
+++ b/stdlib/source/lux/target/js.lux
@@ -32,7 +32,7 @@
(|>> :representation))
(template [<type> <brand> <super>+]
- [(abstract: #export (<brand> brand) Any)
+ [(abstract: (<brand> brand) Any)
(`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))]
[Expression Expression' [Code]]
diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux
index 700dff481..e38694d08 100644
--- a/stdlib/source/lux/target/python.lux
+++ b/stdlib/source/lux/target/python.lux
@@ -339,18 +339,25 @@
(template [<keyword> <0>]
[(def: #export <0>
- Statement
+ (Statement Any)
(:abstraction <keyword>))]
["break" break]
["continue" continue]
)
- (def: #export (while test body!)
- (-> (Expression Any) (Statement Any) Loop)
+ (def: #export (while test body! else!)
+ (-> (Expression Any) (Statement Any) (Maybe (Statement Any)) Loop)
(:abstraction
(format "while " (:representation test) ":"
- (..nest (:representation body!)))))
+ (..nest (:representation body!))
+ (case else!
+ (#.Some else!)
+ (format text.new_line "else:"
+ (..nest (:representation else!)))
+
+ #.None
+ ""))))
(def: #export (for_in var inputs body!)
(-> SVar (Expression Any) (Statement Any) Loop)
@@ -461,6 +468,8 @@
["int"]
["len"]
["chr"]
+ ["unichr"]
+ ["unicode"]
["repr"]
["__import__"]
["Exception"]]]
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
index 285499f13..90cafc75b 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -111,7 +111,7 @@
(/.install "/" (binary (product.uncurry _.//)))
(/.install "%" (binary (product.uncurry //runtime.i64//remainder)))
(/.install "f64" (unary _.float/1))
- (/.install "char" (unary _.chr/1))
+ (/.install "char" (unary //runtime.i64//char))
)))
(def: f64_procs
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index 5487cc628..9fa7107bb 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -99,57 +99,46 @@
list.concat))]
(~ body)))))))
-(def: (runtime_name name)
- (-> Text [Code Code])
- (let [identifier (format ..prefix
- "_" (%.nat $.version)
- "_" (%.nat (text\hash name)))]
- [(` (_.var (~ (code.text identifier))))
- (code.local_identifier identifier)]))
-
(syntax: (runtime: {declaration (<>.or <code>.local_identifier
(<code>.form (<>.and <code>.local_identifier
(<>.some <code>.local_identifier))))}
code)
- (case declaration
- (#.Left name)
- (macro.with_gensyms [g!_]
- (let [[runtime_nameC runtime_nameC!] (..runtime_name name)
- nameC (code.local_identifier name)]
- (wrap (list (` (def: (~ runtime_nameC!)
- Var
- (~ runtime_nameC)))
-
- (` (def: #export (~ nameC)
- (~ runtime_nameC!)))
-
- (` (def: (~ (code.local_identifier (format "@" name)))
- Statement
- (..feature (~ runtime_nameC)
- (function ((~ g!_) (~ nameC))
- (~ code)))))))))
-
- (#.Right [name inputs])
- (macro.with_gensyms [g!_]
- (let [[runtime_nameC runtime_nameC!] (..runtime_name name)
- nameC (code.local_identifier name)
- code_nameC (code.local_identifier (format "@" name))
- inputsC (list\map code.local_identifier inputs)
- inputs_typesC (list\map (function.constant (` _.Expression)) inputs)]
- (wrap (list (` (def: ((~ runtime_nameC!) (~+ inputsC))
- (-> (~+ inputs_typesC) Computation)
- (_.apply/* (~ runtime_nameC) (list (~+ inputsC)))))
-
- (` (def: #export (~ nameC)
- (~ runtime_nameC!)))
-
- (` (def: (~ (code.local_identifier (format "@" name)))
- Statement
- (..feature (~ runtime_nameC)
- (function ((~ g!_) (~ g!_))
- (..with_vars [(~+ inputsC)]
- (_.function (~ g!_) (list (~+ inputsC))
- (~ code)))))))))))))
+ (macro.with_gensyms [g!_ runtime]
+ (let [runtime_name (` (_.var (~ (code.text (%.code runtime)))))]
+ (case declaration
+ (#.Left name)
+ (let [g!name (code.local_identifier name)]
+ (wrap (list (` (def: (~ runtime)
+ Var
+ (~ runtime_name)))
+
+ (` (def: #export (~ g!name)
+ (~ runtime)))
+
+ (` (def: (~ (code.local_identifier (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!name))
+ (~ code))))))))
+
+ (#.Right [name inputs])
+ (let [g!name (code.local_identifier name)
+ inputsC (list\map code.local_identifier inputs)
+ inputs_typesC (list\map (function.constant (` _.Expression)) inputs)]
+ (wrap (list (` (def: ((~ runtime) (~+ inputsC))
+ (-> (~+ inputs_typesC) Computation)
+ (_.apply/* (~ runtime_name) (list (~+ inputsC)))))
+
+ (` (def: #export (~ g!name)
+ (~ runtime)))
+
+ (` (def: (~ (code.local_identifier (format "@" name)))
+ Statement
+ (..feature (~ runtime_name)
+ (function ((~ g!_) (~ g!_))
+ (..with_vars [(~+ inputsC)]
+ (_.function (~ g!_) (list (~+ inputsC))
+ (~ code))))))))))))))
(def: length
(-> Expression Computation)
@@ -318,7 +307,9 @@
(|> i64 (_.the ..i64_low_field) (_.+ i64//2^32)))))
(runtime: (i64//to_number i64)
- (_.return (|> i64 (_.the ..i64_high_field) (_.* i64//2^32)
+ (_.return (|> i64
+ (_.the ..i64_high_field)
+ (_.* i64//2^32)
(_.+ (i64//unsigned_low i64)))))
(runtime: i64//zero
@@ -364,13 +355,21 @@
(_.define r00 (ll parameter))
(_.define x00 (_.+ l00 r00))
- (_.define x16 (high_16 x00))
+
+ (_.define x16 (|> (high_16 x00)
+ (_.+ l16)
+ (_.+ r16)))
(_.set x00 (low_16 x00))
- (_.set x16 (|> x16 (_.+ l16) (_.+ r16)))
- (_.define x32 (high_16 x16))
+
+ (_.define x32 (|> (high_16 x16)
+ (_.+ l32)
+ (_.+ r32)))
(_.set x16 (low_16 x16))
- (_.set x32 (|> x32 (_.+ l32) (_.+ r32)))
- (_.define x48 (|> (high_16 x32) (_.+ l48) (_.+ r48) low_16))
+
+ (_.define x48 (|> (high_16 x32)
+ (_.+ l48)
+ (_.+ r48)
+ low_16))
(_.set x32 (low_16 x32))
(_.return (..i64 (_.bit_or (up_16 x48) x32)
@@ -394,33 +393,33 @@
(_.bit_not (_.the ..i64_low_field value)))))
(runtime: (i64//negate value)
- (_.if (i64//= i64//min value)
- (_.return i64//min)
- (_.return (i64//+ i64//one (i64//not value)))))
+ (_.return (_.? (i64//= i64//min value)
+ i64//min
+ (i64//+ i64//one (i64//not value)))))
(runtime: i64//-one
(i64//negate i64//one))
(runtime: (i64//from_number value)
- (_.cond (list [(_.not_a_number? value)
- (_.return i64//zero)]
- [(_.<= (_.negate i64//2^63) value)
- (_.return i64//min)]
- [(|> value (_.+ (_.i32 +1)) (_.>= i64//2^63))
- (_.return i64//max)]
- [(|> value (_.< (_.i32 +0)))
- (_.return (|> value _.negate i64//from_number i64//negate))])
- (_.return (..i64 (|> value (_./ i64//2^32) _.to_i32)
- (|> value (_.% i64//2^32) _.to_i32)))))
+ (_.return (<| (_.? (_.not_a_number? value)
+ i64//zero)
+ (_.? (_.<= (_.negate i64//2^63) value)
+ i64//min)
+ (_.? (|> value (_.+ (_.i32 +1)) (_.>= i64//2^63))
+ i64//max)
+ (_.? (|> value (_.< (_.i32 +0)))
+ (|> value _.negate i64//from_number i64//negate))
+ (..i64 (|> value (_./ i64//2^32) _.to_i32)
+ (|> value (_.% i64//2^32) _.to_i32)))))
(def: (cap_shift! shift)
(-> Var Statement)
(_.set shift (|> shift (_.bit_and (_.i32 +63)))))
(def: (no_shift! shift input)
- (-> Var Var [Expression Statement])
- [(|> shift (_.= (_.i32 +0)))
- (_.return input)])
+ (-> Var Var (-> Expression Expression))
+ (_.? (|> shift (_.= (_.i32 +0)))
+ input))
(def: small_shift?
(-> Var Expression)
@@ -429,43 +428,44 @@
(runtime: (i64//left_shift input shift)
($_ _.then
(..cap_shift! shift)
- (_.cond (list (..no_shift! shift input)
- [(..small_shift? shift)
- (let [high (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift shift))
- (|> input (_.the ..i64_low_field) (_.logic_right_shift (_.- shift (_.i32 +32)))))
- low (|> input (_.the ..i64_low_field) (_.left_shift shift))]
- (_.return (..i64 high low)))])
- (let [high (|> input (_.the ..i64_low_field) (_.left_shift (_.- (_.i32 +32) shift)))]
- (_.return (..i64 high (_.i32 +0)))))))
+ (_.return (<| (..no_shift! shift input)
+ (_.? (..small_shift? shift)
+ (let [high (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift shift))
+ (|> input (_.the ..i64_low_field) (_.logic_right_shift (_.- shift (_.i32 +32)))))
+ low (|> input (_.the ..i64_low_field) (_.left_shift shift))]
+ (..i64 high low)))
+ (let [high (|> input (_.the ..i64_low_field) (_.left_shift (_.- (_.i32 +32) shift)))]
+ (..i64 high (_.i32 +0)))))
+ ))
(runtime: (i64//arithmetic_right_shift input shift)
($_ _.then
(..cap_shift! shift)
- (_.cond (list (..no_shift! shift input)
- [(..small_shift? shift)
- (let [high (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift shift))
- low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift)
- (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))]
- (_.return (..i64 high low)))])
- (let [high (_.? (|> input (_.the ..i64_high_field) (_.>= (_.i32 +0)))
- (_.i32 +0)
- (_.i32 -1))
- low (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift (_.- (_.i32 +32) shift)))]
- (_.return (..i64 high low))))))
+ (_.return (<| (..no_shift! shift input)
+ (_.? (..small_shift? shift)
+ (let [high (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift shift))
+ low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift)
+ (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))]
+ (..i64 high low)))
+ (let [high (_.? (|> input (_.the ..i64_high_field) (_.>= (_.i32 +0)))
+ (_.i32 +0)
+ (_.i32 -1))
+ low (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift (_.- (_.i32 +32) shift)))]
+ (..i64 high low))))))
(runtime: (i64//right_shift input shift)
($_ _.then
(..cap_shift! shift)
- (_.cond (list (..no_shift! shift input)
- [(..small_shift? shift)
- (let [high (|> input (_.the ..i64_high_field) (_.logic_right_shift shift))
- low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift)
- (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))]
- (_.return (..i64 high low)))]
- [(|> shift (_.= (_.i32 +32)))
- (_.return (..i64 (_.i32 +0) (|> input (_.the ..i64_high_field))))])
- (_.return (..i64 (_.i32 +0)
- (|> input (_.the ..i64_high_field) (_.logic_right_shift (_.- (_.i32 +32) shift))))))))
+ (_.return (<| (..no_shift! shift input)
+ (_.? (..small_shift? shift)
+ (let [high (|> input (_.the ..i64_high_field) (_.logic_right_shift shift))
+ low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift)
+ (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))]
+ (..i64 high low)))
+ (_.? (|> shift (_.= (_.i32 +32)))
+ (..i64 (_.i32 +0) (|> input (_.the ..i64_high_field))))
+ (..i64 (_.i32 +0)
+ (|> input (_.the ..i64_high_field) (_.logic_right_shift (_.- (_.i32 +32) shift))))))))
(def: runtime//bit
Statement
@@ -483,64 +483,67 @@
(_.return (i64//+ (i64//negate parameter) subject)))
(runtime: (i64//* parameter subject)
- (let [negative? (|>> (_.the ..i64_high_field) (_.< (_.i32 +0)))]
- (_.cond (list [(negative? subject)
- (_.if (negative? parameter)
- ## Both are negative
- (_.return (i64//* (i64//negate parameter) (i64//negate subject)))
- ## Subject is negative
- (_.return (i64//negate (i64//* parameter (i64//negate subject)))))]
- [(negative? parameter)
- ## Parameter is negative
- (_.return (i64//negate (i64//* (i64//negate parameter) subject)))])
- ## Both are positive
- (let [up_16 (_.left_shift (_.i32 +16))
- high_16 (_.logic_right_shift (_.i32 +16))
- low_16 (_.bit_and (_.i32 (.int (hex "FFFF"))))
- hh (|>> (_.the ..i64_high_field) high_16)
- hl (|>> (_.the ..i64_high_field) low_16)
- lh (|>> (_.the ..i64_low_field) high_16)
- ll (|>> (_.the ..i64_low_field) low_16)]
- (with_vars [l48 l32 l16 l00
- r48 r32 r16 r00
- x48 x32 x16 x00]
- ($_ _.then
- (_.define l48 (hh subject))
- (_.define l32 (hl subject))
- (_.define l16 (lh subject))
- (_.define l00 (ll subject))
-
- (_.define r48 (hh parameter))
- (_.define r32 (hl parameter))
- (_.define r16 (lh parameter))
- (_.define r00 (ll parameter))
-
- (_.define x00 (_.* l00 r00))
- (_.define x16 (high_16 x00))
- (_.set x00 (low_16 x00))
-
- (_.set x16 (|> x16 (_.+ (_.* l16 r00))))
- (_.define x32 (high_16 x16)) (_.set x16 (low_16 x16))
- (_.set x16 (|> x16 (_.+ (_.* l00 r16))))
- (_.set x32 (|> x32 (_.+ (high_16 x16)))) (_.set x16 (low_16 x16))
-
- (_.set x32 (|> x32 (_.+ (_.* l32 r00))))
- (_.define x48 (high_16 x32)) (_.set x32 (low_16 x32))
- (_.set x32 (|> x32 (_.+ (_.* l16 r16))))
- (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32))
- (_.set x32 (|> x32 (_.+ (_.* l00 r32))))
- (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32))
-
- (_.set x48 (|> x48
- (_.+ (_.* l48 r00))
- (_.+ (_.* l32 r16))
- (_.+ (_.* l16 r32))
- (_.+ (_.* l00 r48))
- low_16))
-
- (_.return (..i64 (_.bit_or (up_16 x48) x32)
- (_.bit_or (up_16 x16) x00)))
- ))))))
+ (let [up_16 (_.left_shift (_.i32 +16))
+ high_16 (_.logic_right_shift (_.i32 +16))
+ low_16 (_.bit_and (_.i32 (.int (hex "FFFF"))))
+ hh (|>> (_.the ..i64_high_field) high_16)
+ hl (|>> (_.the ..i64_high_field) low_16)
+ lh (|>> (_.the ..i64_low_field) high_16)
+ ll (|>> (_.the ..i64_low_field) low_16)]
+ (with_vars [l48 l32 l16 l00
+ r48 r32 r16 r00
+ x48 x32 x16 x00]
+ ($_ _.then
+ (_.define l48 (hh subject))
+ (_.define l32 (hl subject))
+ (_.define l16 (lh subject))
+ (_.define l00 (ll subject))
+
+ (_.define r48 (hh parameter))
+ (_.define r32 (hl parameter))
+ (_.define r16 (lh parameter))
+ (_.define r00 (ll parameter))
+
+ (_.define x00 (_.* l00 r00))
+ (_.define x16 (high_16 x00))
+ (_.set x00 (low_16 x00))
+
+ (_.set x16 (|> x16 (_.+ (_.* l16 r00))))
+ (_.define x32 (high_16 x16)) (_.set x16 (low_16 x16))
+ (_.set x16 (|> x16 (_.+ (_.* l00 r16))))
+ (_.set x32 (|> x32 (_.+ (high_16 x16)))) (_.set x16 (low_16 x16))
+
+ (_.set x32 (|> x32 (_.+ (_.* l32 r00))))
+ (_.define x48 (high_16 x32)) (_.set x32 (low_16 x32))
+ (_.set x32 (|> x32 (_.+ (_.* l16 r16))))
+ (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32))
+ (_.set x32 (|> x32 (_.+ (_.* l00 r32))))
+ (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32))
+
+ (_.set x48 (|> x48
+ (_.+ (_.* l48 r00))
+ (_.+ (_.* l32 r16))
+ (_.+ (_.* l16 r32))
+ (_.+ (_.* l00 r48))
+ low_16))
+
+ (_.return (..i64 (_.bit_or (up_16 x48) x32)
+ (_.bit_or (up_16 x16) x00)))
+ ))))
+
+## (runtime: (i64//* parameter subject)
+## (let [negative? (|>> (_.the ..i64_high_field) (_.< (_.i32 +0)))]
+## (_.cond (list [(negative? subject)
+## (_.if (negative? parameter)
+## ## Both are negative
+## (_.return (i64//*' (i64//negate parameter) (i64//negate subject)))
+## ## Subject is negative
+## (_.return (i64//negate (i64//*' parameter (i64//negate subject)))))]
+## [(negative? parameter)
+## ## Parameter is negative
+## (_.return (i64//negate (i64//*' (i64//negate parameter) subject)))])
+## ## Both are positive
+## (_.return (i64//*' parameter subject)))))
(runtime: (i64//< parameter subject)
(let [negative? (|>> (_.the ..i64_high_field) (_.< (_.i32 +0)))]
@@ -548,16 +551,17 @@
($_ _.then
(_.define -subject? (negative? subject))
(_.define -parameter? (negative? parameter))
- (_.cond (list [(_.and -subject? (_.not -parameter?))
- (_.return (_.boolean true))]
- [(_.and (_.not -subject?) -parameter?)
- (_.return (_.boolean false))])
- (_.return (negative? (i64//- parameter subject))))))))
+ (_.return (<| (_.? (_.and -subject? (_.not -parameter?))
+ (_.boolean true))
+ (_.? (_.and (_.not -subject?) -parameter?)
+ (_.boolean false))
+ (negative? (i64//- parameter subject))))
+ ))))
(def: (i64//<= param subject)
(-> Expression Expression Expression)
- (_.or (i64//< param subject)
- (i64//= param subject)))
+ (|> (i64//< param subject)
+ (_.or (i64//= param subject))))
(runtime: (i64/// parameter subject)
(let [negative? (function (_ value)
@@ -668,6 +672,7 @@
@i64//to_number
@i64//from_number
@i64//-
+ ## @i64//*'
@i64//*
@i64//<
@i64///
@@ -679,9 +684,9 @@
(with_vars [idx]
($_ _.then
(_.define idx (|> text (_.do "indexOf" (list part (i64//to_number start)))))
- (_.if (_.= (_.i32 -1) idx)
- (_.return ..none)
- (_.return (..some (i64//from_number idx)))))))
+ (_.return (_.? (_.= (_.i32 -1) idx)
+ ..none
+ (..some (i64//from_number idx)))))))
(runtime: (text//clip start end text)
(_.return (|> text (_.do "substring" (list (_.the ..i64_low_field start)
@@ -735,9 +740,9 @@
(with_vars [temp]
($_ _.then
(_.define temp (_.at field object))
- (_.if (_.= _.undefined temp)
- (_.return ..none)
- (_.return (..some temp))))))
+ (_.return (_.? (_.= _.undefined temp)
+ ..none
+ (..some temp))))))
(runtime: (js//set object field input)
($_ _.then
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python.lux
index 4d6000fbc..2de025059 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python.lux
@@ -46,7 +46,7 @@
[#////synthesis.Extension])
(^ (////synthesis.branch/case case))
- (/case.case! statement expression archive case)
+ (/case.case! false statement expression archive case)
(^ (////synthesis.branch/let let))
(/case.let! statement expression archive let)
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index a1ae27d5e..62225bb9c 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -35,6 +35,10 @@
[meta
[archive (#+ Archive)]]]]]]])
+(def: #export (gensym prefix)
+ (-> Text (Operation SVar))
+ (///////phase\map (|>> %.nat (format prefix) _.var) /////generation.next))
+
(def: #export register
(-> Register SVar)
(|>> (///reference.local //reference.system) :assume))
@@ -147,19 +151,30 @@
[right_choice (_.string "") inc]
)
-(def: (alternation pre! post!)
- (-> (Statement Any) (Statement Any) (Statement Any))
- ($_ _.then
- (_.while (_.bool true)
- ($_ _.then
- ..save!
- pre!))
- ($_ _.then
- ..restore!
- post!)))
-
-(def: (pattern_matching' statement expression archive)
- (-> Phase! Phase Archive Path (Operation (Statement Any)))
+(def: (alternation in_closure? g!once pre! post!)
+ (-> Bit SVar (Statement Any) (Statement Any) (Statement Any))
+ (.if in_closure?
+ ($_ _.then
+ (_.while (_.bool true)
+ ($_ _.then
+ ..save!
+ pre!)
+ #.None)
+ ..restore!
+ post!)
+ ($_ _.then
+ (_.set (list g!once) (_.bool true))
+ (_.while g!once
+ ($_ _.then
+ (_.set (list g!once) (_.bool false))
+ ..save!
+ pre!)
+ (#.Some _.continue))
+ ..restore!
+ post!)))
+
+(def: (pattern_matching' in_closure? statement expression archive)
+ (-> Bit Phase! Phase Archive Path (Operation (Statement Any)))
(function (recur pathP)
(.case pathP
(^ (/////synthesis.path/then bodyS))
@@ -249,23 +264,38 @@
(..multi_pop! (n.+ 2 extra_pops))
next!))))
- (^template [<tag> <combinator>]
- [(^ (<tag> preP postP))
- (do ///////phase.monad
- [pre! (recur preP)
- post! (recur postP)]
- (wrap (<combinator> pre! post!)))])
- ([/////synthesis.path/seq _.then]
- [/////synthesis.path/alt ..alternation]))))
-
-(def: (pattern_matching statement expression archive pathP)
- (-> Phase! Phase Archive Path (Operation (Statement Any)))
+ (^ (/////synthesis.path/seq preP postP))
+ (do ///////phase.monad
+ [pre! (recur preP)
+ post! (recur postP)]
+ (wrap (_.then pre! post!)))
+
+ (^ (/////synthesis.path/alt preP postP))
+ (do ///////phase.monad
+ [pre! (recur preP)
+ post! (recur postP)
+ g!once (..gensym "once")]
+ (wrap (..alternation in_closure? g!once pre! post!))))))
+
+(def: (pattern_matching in_closure? statement expression archive pathP)
+ (-> Bit Phase! Phase Archive Path (Operation (Statement Any)))
(do ///////phase.monad
- [pattern_matching! (pattern_matching' statement expression archive pathP)]
- (wrap ($_ _.then
- (_.while (_.bool true)
- pattern_matching!)
- (_.raise (_.Exception/1 (_.string case.pattern_matching_error)))))))
+ [pattern_matching! (pattern_matching' in_closure? statement expression archive pathP)
+ g!once (..gensym "once")]
+ (wrap (.if in_closure?
+ ($_ _.then
+ (_.while (_.bool true)
+ pattern_matching!
+ #.None)
+ (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))
+ ($_ _.then
+ (_.set (list g!once) (_.bool true))
+ (_.while g!once
+ ($_ _.then
+ (_.set (list g!once) (_.bool false))
+ pattern_matching!)
+ (#.Some _.continue))
+ (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))))
(def: #export dependencies
(-> Path (List SVar))
@@ -280,15 +310,11 @@
(#///////variable.Foreign register)
(..capture register))))))
-(def: #export (gensym prefix)
- (-> Text (Operation SVar))
- (///////phase\map (|>> %.nat (format prefix) _.var) /////generation.next))
-
-(def: #export (case! statement expression archive [valueS pathP])
- (Generator! [Synthesis Path])
+(def: #export (case! in_closure? statement expression archive [valueS pathP])
+ (-> Bit (Generator! [Synthesis Path]))
(do ///////phase.monad
[stack_init (expression archive valueS)
- pattern_matching! (pattern_matching statement expression archive pathP)]
+ pattern_matching! (pattern_matching in_closure? statement expression archive pathP)]
(wrap ($_ _.then
(_.set (list @cursor) (_.list (list stack_init)))
(_.set (list @savepoint) (_.list (list)))
@@ -299,7 +325,7 @@
(-> Phase! (Generator [Synthesis Path]))
(do ///////phase.monad
[[[case_module case_artifact] pattern_matching!] (/////generation.with_new_context archive
- (case! statement expression archive [valueS pathP]))
+ (case! true statement expression archive [valueS pathP]))
#let [@case (_.var (///reference.artifact [case_module case_artifact]))
@dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS)
pathP))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index 8ef3446f5..f2c71eae8 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -68,10 +68,8 @@
(def: #export (function statement expression archive [environment arity bodyS])
(-> Phase! (Generator (Abstraction Synthesis)))
(do {! ///////phase.monad}
- [@expected_exception (//case.gensym "expected_exception")
- @actual_exception (//case.gensym "actual_exception")
- [[function_module function_artifact] body!] (/////generation.with_new_context archive
- (/////generation.with_anchor [1 @expected_exception]
+ [[[function_module function_artifact] body!] (/////generation.with_new_context archive
+ (/////generation.with_anchor 1
(statement expression archive bodyS)))
environment (monad.map ! (expression archive) environment)
#let [@curried (_.var "curried")
@@ -93,7 +91,7 @@
(_.set (list @num_args) (_.len/1 @curried))
(_.cond (list [(|> @num_args (_.= arityO))
(<| (_.then initialize!)
- (//loop.set_scope @expected_exception @actual_exception)
+ //loop.set_scope
body!)]
[(|> @num_args (_.> arityO))
(let [arity_inputs (_.slice (_.int +0) arityO @curried)
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
index c330d1f45..83f093001 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
@@ -40,18 +40,11 @@
list.reverse
(list\fold _.then body)))
-(def: #export (set_scope @expected_exception @actual_exception body!)
- (-> SVar SVar (Statement Any) (Statement Any))
- (let [exception_class (_.var "Exception")]
- ($_ _.then
- (_.set (list @expected_exception) (_.apply/* exception_class (list (_.string ""))))
- (_.while (_.bool true)
- (_.try body!
- (list {#_.classes (list exception_class)
- #_.exception @actual_exception
- #_.handler (_.if (_.is @expected_exception @actual_exception)
- _.continue
- (_.raise @actual_exception))}))))))
+(def: #export (set_scope body!)
+ (-> (Statement Any) (Statement Any))
+ (_.while (_.bool true)
+ body!
+ #.None))
(def: #export (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
@@ -64,12 +57,10 @@
_
(do {! ///////phase.monad}
[initsO+ (monad.map ! (expression archive) initsS+)
- @expected_exception (//case.gensym "expected_exception")
- @actual_exception (//case.gensym "actual_exception")
- body! (/////generation.with_anchor [start @expected_exception]
+ body! (/////generation.with_anchor start
(statement expression archive bodyS))]
(wrap (<| (..setup start initsO+)
- (set_scope @expected_exception @actual_exception)
+ ..set_scope
body!)))))
(def: #export (scope statement expression archive [start initsS+ bodyS])
@@ -82,18 +73,16 @@
## true loop
_
(do {! ///////phase.monad}
- [@expected_exception (//case.gensym "expected_exception")
- @actual_exception (//case.gensym "actual_exception")
- initsO+ (monad.map ! (expression archive) initsS+)
+ [initsO+ (monad.map ! (expression archive) initsS+)
[[loop_module loop_artifact] body!] (/////generation.with_new_context archive
- (/////generation.with_anchor [start @expected_exception]
+ (/////generation.with_anchor start
(statement expression archive bodyS)))
#let [@loop (_.var (///reference.artifact [loop_module loop_artifact]))
locals (|> initsS+
list.enumeration
(list\map (|>> product.left (n.+ start) //case.register)))
actual_loop (<| (_.def @loop locals)
- (set_scope @expected_exception @actual_exception)
+ ..set_scope
body!)
[directive instantiation] (: [(Statement Any) (Expression Any)]
(case (|> (synthesis.path/then bodyS)
@@ -119,7 +108,7 @@
(def: #export (recur! statement expression archive argsS+)
(Generator! (List Synthesis))
(do {! ///////phase.monad}
- [[offset @exception] /////generation.anchor
+ [offset /////generation.anchor
@temp (//case.gensym "lux_recur_values")
argsO+ (monad.map ! (expression archive) argsS+)
#let [re_binds (|> argsO+
@@ -129,4 +118,4 @@
(wrap ($_ _.then
(_.set (list @temp) (_.list argsO+))
(..setup offset re_binds
- (_.raise @exception))))))
+ _.continue)))))
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index f32712fc2..132ec3c98 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -39,7 +39,7 @@
(template [<name> <base>]
[(type: #export <name>
- (<base> [Register SVar] (Expression Any) (Statement Any)))]
+ (<base> Register (Expression Any) (Statement Any)))]
[Operation /////generation.Operation]
[Phase /////generation.Phase]
@@ -214,28 +214,29 @@
(_.set (list tuple) (_.nth last_index_right tuple))))]
(runtime: (tuple//left lefts tuple)
(with_vars [last_index_right]
- (<| (_.while (_.bool true))
- ($_ _.then
- (_.set (list last_index_right) (..last_index tuple))
- (_.if (_.> lefts last_index_right)
- ## No need for recursion
- (_.return (_.nth lefts tuple))
- ## Needs recursion
- <recur>)))))
+ (_.while (_.bool true)
+ ($_ _.then
+ (_.set (list last_index_right) (..last_index tuple))
+ (_.if (_.> lefts last_index_right)
+ ## No need for recursion
+ (_.return (_.nth lefts tuple))
+ ## Needs recursion
+ <recur>))
+ #.None)))
(runtime: (tuple//right lefts tuple)
(with_vars [last_index_right right_index]
- (<| (_.while (_.bool true))
- ($_ _.then
- (_.set (list last_index_right) (..last_index tuple))
- (_.set (list right_index) (_.+ (_.int +1) lefts))
- (_.cond (list [(_.= last_index_right right_index)
- (_.return (_.nth right_index tuple))]
- [(_.> last_index_right right_index)
- ## Needs recursion.
- <recur>])
- (_.return (_.slice_from right_index tuple)))
- )))))
+ (_.while (_.bool true)
+ ($_ _.then
+ (_.set (list last_index_right) (..last_index tuple))
+ (_.set (list right_index) (_.+ (_.int +1) lefts))
+ (_.cond (list [(_.= last_index_right right_index)
+ (_.return (_.nth right_index tuple))]
+ [(_.> last_index_right right_index)
+ ## Needs recursion.
+ <recur>])
+ (_.return (_.slice_from right_index tuple))))
+ #.None))))
(runtime: (sum//get sum wantsLast wantedTag)
(let [no_match! (_.return _.none)
@@ -321,6 +322,17 @@
[i64//xor _.bit_xor]
)
+(def: version
+ (Expression Any)
+ (|> (_.__import__/1 (_.unicode "sys"))
+ (_.the "version_info")
+ (_.the "major")))
+
+(runtime: (i64//char value)
+ (_.return (_.? (_.= (_.int +3) ..version)
+ (_.chr/1 value)
+ (_.unichr/1 value))))
+
(def: runtime//i64
(Statement Any)
($_ _.then
@@ -334,6 +346,7 @@
@i64//and
@i64//or
@i64//xor
+ @i64//char
))
(runtime: (f64//decode input)
diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux
index 9372cc4e0..ee7140e8b 100644
--- a/stdlib/source/lux/type.lux
+++ b/stdlib/source/lux/type.lux
@@ -415,9 +415,9 @@
(<c>.record (<>.and <c>.any <c>.any)))
## TODO: Make sure the generated code always gets optimized away.
-(syntax: #export (:share {type_vars type_parameters}
- {exemplar typed}
- {computation typed})
+(syntax: #export (:share {type_vars ..type_parameters}
+ {exemplar ..typed}
+ {computation ..typed})
(macro.with_gensyms [g!_]
(let [shareC (` (: (All [(~+ (list\map code.local_identifier type_vars))]
(-> (~ (get@ #type exemplar))
@@ -426,8 +426,8 @@
(~ (get@ #expression computation)))))]
(wrap (list (` ((~ shareC) (~ (get@ #expression exemplar)))))))))
-(syntax: #export (:by_example {type_vars type_parameters}
- {exemplar typed}
+(syntax: #export (:by_example {type_vars ..type_parameters}
+ {exemplar ..typed}
{extraction <c>.any})
(wrap (list (` (:of ((~! :share)
[(~+ (list\map code.local_identifier type_vars))]
diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux
index fd5480bc6..8db23a9a2 100644
--- a/stdlib/source/lux/type/quotient.lux
+++ b/stdlib/source/lux/type/quotient.lux
@@ -1,31 +1,35 @@
(.module:
[lux (#- type)
- [type (#+ :by-example)
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [macro (#+ with_gensyms)
+ [syntax (#+ syntax:)]]
+ ["." type
abstract]])
-(abstract: #export (Class t c q)
+(abstract: #export (Class t c %)
(-> t c)
(def: #export class
(All [t c]
- (Ex [q]
- (-> (-> t c) (Class t c q))))
+ (Ex [%]
+ (-> (-> t c) (Class t c %))))
(|>> :abstraction))
- (abstract: #export (Quotient t c q)
+ (abstract: #export (Quotient t c %)
{#value t
#label c}
(def: #export (quotient class value)
- (All [t c q]
- (-> (Class t c q) t
- (Quotient t c q)))
+ (All [t c %]
+ (-> (Class t c %) t
+ (Quotient t c %)))
(:abstraction {#value value
#label ((:representation Class class) value)}))
(template [<name> <output> <slot>]
[(def: #export <name>
- (All [t c q] (-> (Quotient t c q) <output>))
+ (All [t c %] (-> (Quotient t c %) <output>))
(|>> :representation (get@ <slot>)))]
[value t #value]
@@ -34,8 +38,16 @@
)
)
-(template: #export (type <class>)
- (:by-example [t c q]
- {(..Class t c q)
- <class>}
- (..Quotient t c q)))
+(syntax: #export (type class)
+ (with_gensyms [g!t g!c g!%]
+ (wrap (list (` ((~! type.:by_example)
+ [(~ g!t) (~ g!c) (~ g!%)]
+ {(..Class (~ g!t) (~ g!c) (~ g!%))
+ (~ class)}
+ (..Quotient (~ g!t) (~ g!c) (~ g!%))))))))
+
+(structure: #export (equivalence super)
+ (All [t c %] (-> (Equivalence c) (Equivalence (..Quotient t c %))))
+
+ (def: (= reference sample)
+ (\ super = (..label reference) (..label sample))))
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
new file mode 100644
index 000000000..7356d897c
--- /dev/null
+++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux
@@ -0,0 +1,42 @@
+(.module:
+ [lux #*
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [data
+ ["." product]
+ ["." text
+ ["%" format]]]]
+ ["." /// (#+ Snapshot)
+ ["#." time]
+ ["#." stamp]])
+
+(type: #export Value
+ {#version Text
+ #snapshot Snapshot})
+
+(def: #export equivalence
+ (Equivalence Value)
+ ($_ product.equivalence
+ text.equivalence
+ ///.equivalence
+ ))
+
+(def: separator
+ "-")
+
+(def: #export snapshot
+ "SNAPSHOT")
+
+(def: #export (format (^slots [#version #snapshot]))
+ (%.Format Value)
+ (case snapshot
+ #///.Local
+ version
+
+ (#///.Remote stamp)
+ (let [(^slots [#///stamp.time #///stamp.build]) stamp]
+ (%.format (text.replace_all ..snapshot
+ (///time.format time)
+ version)
+ ..separator
+ (%.nat build)))))
diff --git a/stdlib/source/program/aedifex/artifact/value.lux b/stdlib/source/program/aedifex/artifact/value.lux
deleted file mode 100644
index 3e92dbf16..000000000
--- a/stdlib/source/program/aedifex/artifact/value.lux
+++ /dev/null
@@ -1,47 +0,0 @@
-(.module:
- [lux #*
- [abstract
- [equivalence (#+ Equivalence)]]
- [data
- ["." product]
- ["." text
- ["%" format]]
- [collection
- ["." list ("#\." functor)]]]
- [math
- [number
- ["." nat]]]
- [time
- ["." instant]]]
- [// (#+ Version)
- ["." time_stamp (#+ Time_Stamp)]])
-
-(type: #export Build
- Nat)
-
-(type: #export Value
- {#version Version
- #time_stamp Time_Stamp
- #build Build})
-
-(def: #export equivalence
- (Equivalence Value)
- ($_ product.equivalence
- text.equivalence
- instant.equivalence
- nat.equivalence
- ))
-
-(def: separator
- "-")
-
-(def: snapshot
- "SNAPSHOT")
-
-(def: #export (format (^slots [#version #time_stamp #build]))
- (%.Format Value)
- (%.format (text.replace_all ..snapshot
- (time_stamp.format time_stamp)
- version)
- ..separator
- (%.nat build)))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot.lux b/stdlib/source/test/aedifex/artifact/snapshot.lux
index 371fde55e..192978ebf 100644
--- a/stdlib/source/test/aedifex/artifact/snapshot.lux
+++ b/stdlib/source/test/aedifex/artifact/snapshot.lux
@@ -16,7 +16,8 @@
["#." build]
["#." time]
["#." stamp]
- ["#." version]]
+ ["#." version
+ ["#/." value]]]
{#program
["." /]})
@@ -47,4 +48,5 @@
$/time.test
$/stamp.test
$/version.test
+ $/version/value.test
))))
diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux
new file mode 100644
index 000000000..dc3f754a2
--- /dev/null
+++ b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux
@@ -0,0 +1,66 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["<.>" text]]]
+ [data
+ ["." text ("#\." equivalence)
+ ["%" format (#+ format)]]]
+ [math
+ ["." random (#+ Random) ("#\." monad)]
+ [number
+ ["n" nat]
+ ["i" int]]]
+ [time
+ ["." instant]]]
+ ["$." /// #_
+ ["#." stamp]]
+ {#program
+ ["." /
+ ["//#" ///
+ ["#." stamp]
+ ["#." time]]]})
+
+(def: #export random
+ (Random /.Value)
+ ($_ random.and
+ (random.ascii/alpha 5)
+ (random.or (random\wrap [])
+ $///stamp.random)
+ ))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Value])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (do random.monad
+ [sample random
+ stamp $///stamp.random]
+ (let [version (get@ #/.version sample)
+
+ local!
+ (text\= version
+ (/.format (set@ #/.snapshot #///.Local sample)))
+
+ remote_format (/.format {#/.version (format version /.snapshot)
+ #/.snapshot (#///.Remote stamp)})
+ remote!
+ (and (text.starts_with? (format version (///time.format (get@ #///stamp.time stamp)))
+ remote_format)
+ (text.ends_with? (%.nat (get@ #///stamp.build stamp))
+ remote_format))]
+ (_.cover [/.snapshot /.format]
+ (and local!
+ remote!))))
+ )))
diff --git a/stdlib/source/test/aedifex/artifact/value.lux b/stdlib/source/test/aedifex/artifact/value.lux
deleted file mode 100644
index 10e9016b1..000000000
--- a/stdlib/source/test/aedifex/artifact/value.lux
+++ /dev/null
@@ -1,38 +0,0 @@
-(.module:
- [lux #*
- ["_" test (#+ Test)]
- [abstract
- [monad (#+ do)]
- {[0 #spec]
- [/
- ["$." equivalence]]}]
- [control
- ["." try ("#\." functor)]
- [parser
- ["<.>" text]]]
- [math
- ["." random (#+ Random)]
- [number
- ["n" nat]
- ["i" int]]]
- [time
- ["." instant]]]
- {#program
- ["." /]})
-
-(def: #export random
- (Random /.Value)
- ($_ random.and
- (random.ascii/alpha 5)
- random.instant
- random.nat
- ))
-
-(def: #export test
- Test
- (<| (_.covering /._)
- (_.for [/.Build /.Value])
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
- )))
diff --git a/stdlib/source/test/lux/control/concurrency/promise.lux b/stdlib/source/test/lux/control/concurrency/promise.lux
index 7fc3196cd..ee6ad2b43 100644
--- a/stdlib/source/test/lux/control/concurrency/promise.lux
+++ b/stdlib/source/test/lux/control/concurrency/promise.lux
@@ -1,6 +1,7 @@
(.module:
[lux #*
["_" test (#+ Test)]
+ ["@" target]
[abstract
[monad (#+ do)]
{[0 #spec]
@@ -18,7 +19,8 @@
["." random]
[number
["n" nat]
- ["i" int]]]]
+ ["i" int]
+ ["." i64]]]]
{1
["." /
[//
@@ -43,11 +45,16 @@
_
false))))))
+(def: delay
+ (for {@.js
+ (i64.left_shift 4 1)}
+ (i64.left_shift 3 1)))
+
(def: #export test
Test
(<| (_.covering /._)
(do {! random.monad}
- [to_wait (|> random.nat (\ ! map (|>> (n.% 10) (n.+ 10))))
+ [to_wait (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay))))
expected random.nat
dummy random.nat
#let [not_dummy (|> random.nat (random.filter (|>> (n.= dummy) not)))]
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 472e21c7d..729e986c2 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -1,6 +1,7 @@
(.module:
[lux #*
["_" test (#+ Test)]
+ ["@" target]
[abstract
["." monad (#+ do)]
["." enum]]
@@ -20,12 +21,18 @@
[math
["." random]
[number
- ["n" nat]]]
+ ["n" nat]
+ ["." i64]]]
[type
["." refinement]]]
{1
["." /]})
+(def: delay
+ (for {@.js
+ (i64.left_shift 4 1)}
+ (i64.left_shift 3 1)))
+
(def: semaphore
Test
(_.for [/.Semaphore]
@@ -34,7 +41,7 @@
[initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1))))
#let [semaphore (/.semaphore initial_open_positions)]]
(wrap (do promise.monad
- [result (promise.time_out 10 (/.wait semaphore))]
+ [result (promise.time_out ..delay (/.wait semaphore))]
(_.cover' [/.semaphore]
(case result
(#.Some _)
@@ -47,7 +54,7 @@
#let [semaphore (/.semaphore initial_open_positions)]]
(wrap (do {! promise.monad}
[_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore))
- result (promise.time_out 10 (/.wait semaphore))]
+ result (promise.time_out ..delay (/.wait semaphore))]
(_.cover' [/.wait]
(case result
(#.Some _)
@@ -61,9 +68,9 @@
(wrap (do {! promise.monad}
[_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore))
#let [block (/.wait semaphore)]
- result/0 (promise.time_out 10 block)
+ result/0 (promise.time_out ..delay block)
open_positions (/.signal semaphore)
- result/1 (promise.time_out 10 block)]
+ result/1 (promise.time_out ..delay block)]
(_.cover' [/.signal]
(case [result/0 result/1 open_positions]
[#.None (#.Some _) (#try.Success +0)]
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 07c02ea09..89237babc 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -51,14 +51,15 @@
(#try.Success _)
false))
-(def: (binary_io bytes read write value)
+(def: (binary_io power read write value)
(-> Nat (-> Nat Binary (Try Nat)) (-> Nat Nat Binary (Try Any)) Nat Bit)
- (let [binary (/.create bytes)
+ (let [bytes (i64.left_shift power 1)
+ binary (/.create bytes)
cap (case bytes
8 (dec 0)
_ (|> 1 (i64.left_shift (n.* 8 bytes)) dec))
capped_value (i64.and cap value)]
- (and (succeed
+ (and (..succeed
(do try.monad
[pre (read 0 binary)
_ (write 0 value binary)
@@ -104,23 +105,23 @@
(_.for [/.index_out_of_bounds]
($_ _.and
(_.cover [/.read/8 /.write/8]
- (..binary_io 1 /.read/8 /.write/8 value))
+ (..binary_io 0 /.read/8 /.write/8 value))
(_.cover [/.read/16 /.write/16]
- (..binary_io 2 /.read/16 /.write/16 value))
+ (..binary_io 1 /.read/16 /.write/16 value))
(_.cover [/.read/32 /.write/32]
- (..binary_io 4 /.read/32 /.write/32 value))
+ (..binary_io 2 /.read/32 /.write/32 value))
(_.cover [/.read/64 /.write/64]
- (..binary_io 8 /.read/64 /.write/64 value))))
+ (..binary_io 3 /.read/64 /.write/64 value))))
(_.cover [/.slice]
(let [slice_size (|> to (n.- from) inc)
random_slice (try.assume (/.slice from to sample))
idxs (enum.range n.enum 0 (dec slice_size))
reader (function (_ binary idx) (/.read/8 idx binary))]
(and (n.= slice_size (/.size random_slice))
- (case [(monad.map try.monad (reader random_slice) idxs)
- (monad.map try.monad (|>> (n.+ from) (reader sample)) idxs)]
- [(#try.Success slice_vals) (#try.Success binary_vals)]
- (\ (list.equivalence n.equivalence) = slice_vals binary_vals)
+ (case [(monad.map try.monad (|>> (n.+ from) (reader sample)) idxs)
+ (monad.map try.monad (reader random_slice) idxs)]
+ [(#try.Success binary_vals) (#try.Success slice_vals)]
+ (\ (list.equivalence n.equivalence) = binary_vals slice_vals)
_
#0))))
diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux
index 855c6e8bb..d032a47b5 100644
--- a/stdlib/source/test/lux/extension.lux
+++ b/stdlib/source/test/lux/extension.lux
@@ -3,7 +3,8 @@
["." debug]
["@" target
["." jvm]
- ["." js]]
+ ["." js]
+ ["." python]]
[abstract
[monad (#+ do)]]
[control
@@ -61,8 +62,8 @@
(wrap (for {@.jvm
(row.row (#jvm.Constant (#jvm.LDC (#jvm.String self))))
- @.js
- (js.string self)})))))
+ @.js (js.string self)
+ @.python (python.unicode self)})))))
(for {@.old
(as_is)}
diff --git a/stdlib/source/test/lux/host.py.lux b/stdlib/source/test/lux/host.py.lux
new file mode 100644
index 000000000..0b6cac81b
--- /dev/null
+++ b/stdlib/source/test/lux/host.py.lux
@@ -0,0 +1,24 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try]]
+ [data
+ ["." text ("#\." equivalence)]]
+ [math
+ ["." random (#+ Random)]
+ [number
+ ["." nat]
+ ["." frac]]]]
+ {1
+ ["." /]})
+
+(def: #export test
+ Test
+ (do {! random.monad}
+ []
+ (<| (_.covering /._)
+ (_.test "TBD"
+ true))))
diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux
index a140a736d..403205dad 100644
--- a/stdlib/source/test/lux/math.lux
+++ b/stdlib/source/test/lux/math.lux
@@ -21,7 +21,8 @@
["#/." continuous]
["#/." fuzzy]]])
-(def: margin Frac +0.0000001)
+(def: margin
+ +0.0000001)
(def: (trigonometric_symmetry forward backward angle)
(-> (-> Frac Frac) (-> Frac Frac) Frac Bit)
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index 70b13a382..b1d205e4a 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -21,6 +21,7 @@
["#." check]
["#." dynamic]
["#." implicit]
+ ["#." quotient]
["#." resource]])
(def: short
@@ -169,5 +170,6 @@
/check.test
/dynamic.test
/implicit.test
+ /quotient.test
/resource.test
)))
diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux
new file mode 100644
index 000000000..ef19c6841
--- /dev/null
+++ b/stdlib/source/test/lux/type/quotient.lux
@@ -0,0 +1,60 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ ["." monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [data
+ ["." text ("#\." equivalence)
+ ["%" format (#+ format)]]]
+ [math
+ ["." random (#+ Random)]
+ [number
+ ["n" nat ("#\." equivalence)]]]]
+ {1
+ ["." /]})
+
+(def: #export (random class super)
+ (All [t c %] (-> (/.Class t c %) (Random t) (Random (/.Quotient t c %))))
+ (\ random.monad map (/.quotient class) super))
+
+(def: mod_10_class
+ (/.class (|>> (n.% 10) %.nat)))
+
+(def: Mod_10
+ (/.type ..mod_10_class))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do random.monad
+ [modulus (random.filter (n.> 0) random.nat)
+ #let [class (: (-> Nat Text)
+ (|>> (n.% modulus) %.nat))]
+ value random.nat]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec (/.equivalence text.equivalence)
+ (..random (/.class class) random.nat)))
+
+ (_.for [/.Class]
+ (_.cover [/.class]
+ (is? (: Any class)
+ (: Any (/.class class)))))
+ (_.for [/.Quotient]
+ ($_ _.and
+ (_.cover [/.quotient /.value /.label]
+ (let [quotient (/.quotient (/.class class) value)]
+ (and (is? value
+ (/.value quotient))
+ (text\= (class value)
+ (/.label quotient)))))
+ (_.cover [/.type]
+ (exec
+ (: ..Mod_10
+ (/.quotient ..mod_10_class value))
+ true))
+ ))
+ ))))