aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2021-09-08 17:25:20 -0400
committerEduardo Julian2021-09-08 17:25:20 -0400
commit18e4294819f5d4adafad091bdc5a30c25959ad2f (patch)
treeb241acb7e32620731eed20a0d86e8b35ca3c5ada /stdlib
parent392582885500d8201bbe502943ca4b02c5c77ac0 (diff)
No more annotations.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/library/lux.lux627
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux24
-rw-r--r--stdlib/source/library/lux/data/format/html.lux4
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux6
-rw-r--r--stdlib/source/library/lux/documentation.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux1
-rw-r--r--stdlib/source/library/lux/ffi.lua.lux14
-rw-r--r--stdlib/source/library/lux/ffi.old.lux1
-rw-r--r--stdlib/source/library/lux/ffi.php.lux10
-rw-r--r--stdlib/source/library/lux/ffi.py.lux54
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux10
-rw-r--r--stdlib/source/library/lux/macro/local.lux2
-rw-r--r--stdlib/source/library/lux/macro/syntax.lux114
-rw-r--r--stdlib/source/library/lux/macro/syntax/export.lux24
-rw-r--r--stdlib/source/library/lux/meta.lux16
-rw-r--r--stdlib/source/library/lux/target/js.lux4
-rw-r--r--stdlib/source/library/lux/type/abstract.lux8
-rw-r--r--stdlib/source/library/lux/type/implicit.lux5
-rw-r--r--stdlib/source/library/lux/type/unit.lux15
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux4
-rw-r--r--stdlib/source/poly/lux/data/format/json.lux2
-rw-r--r--stdlib/source/test/lux/macro.lux2
-rw-r--r--stdlib/source/test/lux/meta.lux10
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux4
-rw-r--r--stdlib/source/test/lux/type/resource.lux2
25 files changed, 254 insertions, 711 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 823132f6c..4b1204bc7 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1,21 +1,17 @@
("lux def" dummy_location
["" 0 0]
- [["" 0 0] (9 #1 (0 #0))]
#0)
("lux def" double_quote
("lux i64 char" +34)
- [dummy_location (9 #1 (0 #0))]
#0)
("lux def" \n
("lux i64 char" +10)
- [dummy_location (9 #1 (0 #0))]
#0)
("lux def" prelude_module
"library/lux"
- [dummy_location (9 #1 (0 #0))]
#1)
... (type: .public Any
@@ -24,8 +20,6 @@
("lux type check type"
(9 #1 ["library/lux" "Any"]
(8 #0 (0 #0) (4 #0 1))))
- [dummy_location
- (9 #1 (0 #0))]
#1)
... (type: .public Nothing
@@ -34,8 +28,6 @@
("lux type check type"
(9 #1 ["library/lux" "Nothing"]
(7 #0 (0 #0) (4 #0 1))))
- [dummy_location
- (9 #1 (0 #0))]
#1)
... (type: .public (List a)
@@ -49,8 +41,6 @@
... "lux.Item"
(2 #0 (4 #0 1)
(9 #0 (4 #0 1) (4 #0 0))))))
- [dummy_location
- (9 #1 (0 #0))]
("End" "Item")
#1)
@@ -58,8 +48,6 @@
("lux type check type"
(9 #1 ["library/lux" "Bit"]
(0 #0 "#Bit" #End)))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" I64
@@ -67,56 +55,42 @@
(9 #1 ["library/lux" "I64"]
(7 #0 (0 #0)
(0 #0 "#I64" (#Item (4 #0 1) #End)))))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Nat
("lux type check type"
(9 #1 ["library/lux" "Nat"]
(0 #0 "#I64" (#Item (0 #0 "#Nat" #End) #End))))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Int
("lux type check type"
(9 #1 ["library/lux" "Int"]
(0 #0 "#I64" (#Item (0 #0 "#Int" #End) #End))))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Rev
("lux type check type"
(9 #1 ["library/lux" "Rev"]
(0 #0 "#I64" (#Item (0 #0 "#Rev" #End) #End))))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Frac
("lux type check type"
(9 #1 ["library/lux" "Frac"]
(0 #0 "#Frac" #End)))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Text
("lux type check type"
(9 #1 ["library/lux" "Text"]
(0 #0 "#Text" #End)))
- [dummy_location
- (9 #1 #End)]
#1)
("lux def" Name
("lux type check type"
(9 #1 ["library/lux" "Name"]
(2 #0 Text Text)))
- [dummy_location
- (9 #1 #End)]
#1)
... (type: .public (Maybe a)
@@ -129,8 +103,6 @@
Any
... "lux.Some"
(4 #0 1))))
- [dummy_location
- (9 #1 #End)]
("None" "Some")
#1)
@@ -190,8 +162,6 @@
("lux type check type" (2 #0 Type Type)))}
("lux type check type" (9 #0 Type List)))}
("lux type check type" (9 #0 (0 #0 ["" #End]) (4 #0 0)))))
- [dummy_location
- (9 #1 #End)]
("Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named")
#1)
@@ -203,8 +173,6 @@
("lux def type tagged" Location
(#Named ["library/lux" "Location"]
(#Product Text (#Product Nat Nat)))
- [dummy_location
- (9 #1 #End)]
["module" "line" "column"]
#1)
@@ -218,8 +186,6 @@
(#UnivQ #End
(#Product (#Parameter 3)
(#Parameter 1)))))
- [dummy_location
- (9 #1 #End)]
["meta" "datum"]
#1)
@@ -268,8 +234,6 @@
("lux type check type" (#Apply (#Apply (#Parameter 1)
(#Parameter 0))
(#Parameter 1)))))
- [dummy_location
- (9 #1 #End)]
("Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record")
#1)
@@ -281,32 +245,22 @@
({w
(#Apply (#Apply w Code') w)}
("lux type check type" (#Apply Location Ann)))))
- [dummy_location
- (#Record #End)]
#1)
("lux def" private
#0
- [dummy_location
- (#Record #End)]
#1)
("lux def" public
#1
- [dummy_location
- (#Record #End)]
#1)
("lux def" local
#0
- [dummy_location
- (#Record #End)]
#1)
("lux def" global
#1
- [dummy_location
- (#Record #End)]
#1)
("lux def" _ann
@@ -316,94 +270,79 @@
Code)
([_ data]
[dummy_location data]))
- [dummy_location (#Record #End)]
#0)
("lux def" bit$
("lux type check" (#Function Bit Code)
([_ value] (_ann (#Bit value))))
- [dummy_location (#Record #End)]
#0)
("lux def" nat$
("lux type check" (#Function Nat Code)
([_ value] (_ann (#Nat value))))
- [dummy_location (#Record #End)]
#0)
("lux def" int$
("lux type check" (#Function Int Code)
([_ value] (_ann (#Int value))))
- [dummy_location (#Record #End)]
#0)
("lux def" rev$
("lux type check" (#Function Rev Code)
([_ value] (_ann (#Rev value))))
- [dummy_location (#Record #End)]
#0)
("lux def" frac$
("lux type check" (#Function Frac Code)
([_ value] (_ann (#Frac value))))
- [dummy_location (#Record #End)]
#0)
("lux def" text$
("lux type check" (#Function Text Code)
([_ text] (_ann (#Text text))))
- [dummy_location (#Record #End)]
#0)
("lux def" identifier$
("lux type check" (#Function Name Code)
([_ name] (_ann (#Identifier name))))
- [dummy_location (#Record #End)]
#0)
("lux def" local_identifier$
("lux type check" (#Function Text Code)
([_ name] (_ann (#Identifier ["" name]))))
- [dummy_location (#Record #End)]
#0)
("lux def" tag$
("lux type check" (#Function Name Code)
([_ name] (_ann (#Tag name))))
- [dummy_location (#Record #End)]
#0)
("lux def" local_tag$
("lux type check" (#Function Text Code)
([_ name] (_ann (#Tag ["" name]))))
- [dummy_location (#Record #End)]
#0)
("lux def" form$
("lux type check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Form tokens))))
- [dummy_location (#Record #End)]
#0)
("lux def" tuple$
("lux type check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Tuple tokens))))
- [dummy_location (#Record #End)]
#0)
("lux def" record$
("lux type check" (#Function (#Apply (#Product Code Code) List) Code)
([_ tokens] (_ann (#Record tokens))))
- [dummy_location (#Record #End)]
#0)
... (type: .public Definition
-... [Bit Type Code Any])
+... [Bit Type Any])
("lux def" Definition
("lux type check type"
(#Named ["library/lux" "Definition"]
- (#Product Bit (#Product Type (#Product Code Any)))))
- (record$ #End)
+ (#Product Bit (#Product Type Any))))
.public)
... (type: .public Alias
@@ -412,7 +351,6 @@
("lux type check type"
(#Named ["library/lux" "Alias"]
Name))
- (record$ #End)
.public)
... (type: .public Label
@@ -421,7 +359,6 @@
("lux type check type"
(#Named ["library/lux" "Label"]
(#Product Bit (#Product Type (#Product (#Apply Text List) Nat)))))
- (record$ #End)
.public)
... (type: .public Global
@@ -440,7 +377,6 @@
(#Sum Label
(#Sum Label
Alias)))))
- (record$ #End)
("Definition" "Type" "Label" "Slot" "Alias")
.public)
@@ -458,7 +394,6 @@
(#Apply (#Product (#Parameter 3)
(#Parameter 1))
List)))))
- (record$ #End)
["counter" "mappings"]
.public)
@@ -471,7 +406,6 @@
Nat
... Captured
Nat))
- (record$ #End)
("Local" "Captured")
.public)
@@ -491,14 +425,12 @@
(#Apply (#Product Type Nat) (#Apply Text Bindings))
... captured
(#Apply (#Product Type Ref) (#Apply Text Bindings))))))
- (record$ #End)
["name" "inner" "locals" "captured"]
.public)
("lux def" Code_List
("lux type check type"
(#Apply Code List))
- (record$ #End)
#0)
... (type: .public (Either l r)
@@ -512,7 +444,6 @@
(#Parameter 3)
... "lux.Right"
(#Parameter 1)))))
- (record$ #End)
("Left" "Right")
.public)
@@ -522,7 +453,6 @@
("lux type check type"
(#Named ["library/lux" "Source"]
(#Product Location (#Product Nat Text))))
- (record$ #End)
.public)
... (type: .public Module_State
@@ -539,7 +469,6 @@
Any
... #Cached
Any)))
- (record$ #End)
("Active" "Compiled" "Cached")
.public)
@@ -567,7 +496,6 @@
... module_state
Module_State
)))))
- (record$ #End)
["module_hash" "module_aliases" "definitions" "imports" "module_state"]
.public)
@@ -585,7 +513,6 @@
... var_bindings
(#Apply (#Product Nat (#Apply Type Maybe))
List))))
- (record$ #End)
["ex_counter" "var_counter" "var_bindings"]
.public)
@@ -601,7 +528,6 @@
Any
... Interpreter
Any)))
- (record$ #End)
("Build" "Eval" "Interpreter")
.public)
@@ -620,7 +546,6 @@
Text
... mode
Mode)))
- (record$ #End)
["target" "version" "mode"]
.public)
@@ -686,7 +611,6 @@
... host
Any))))))))))))))}
(#Apply (0 #0 ["" #End]) (#Parameter 0))))
- (record$ #End)
["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "eval" "host"]
.public)
@@ -699,7 +623,6 @@
(#Function Lux
(#Apply (#Product Lux (#Parameter 1))
(#Apply Text Either))))))
- (record$ #End)
.public)
... (type: .public Macro'
@@ -708,7 +631,6 @@
("lux type check type"
(#Named ["library/lux" "Macro'"]
(#Function Code_List (#Apply Code_List Meta))))
- (record$ #End)
.public)
... (type: .public Macro
@@ -717,7 +639,6 @@
("lux type check type"
(#Named ["library/lux" "Macro"]
(#Primitive "#Macro" #End)))
- (record$ #End)
.public)
... Base functions & macros
@@ -732,7 +653,6 @@
([_ val]
([_ state]
(#Right state val))))
- (record$ #End)
#0)
("lux def" failure
@@ -746,7 +666,6 @@
([_ msg]
([_ state]
(#Left msg))))
- (record$ #End)
#0)
("lux def" let''
@@ -759,7 +678,6 @@
_
(failure "Wrong syntax for let''")}
tokens)))
- (record$ #End)
#0)
("lux def" function''
@@ -796,13 +714,11 @@
_
(failure "Wrong syntax for function''")}
tokens)))
- (record$ #End)
#0)
("lux def" location_code
("lux type check" Code
(tuple$ (#Item (text$ "") (#Item (nat$ 0) (#Item (nat$ 0) #End)))))
- (record$ #End)
#0)
("lux def" meta_code
@@ -812,7 +728,6 @@
(tuple$ (#Item location_code
(#Item (form$ (#Item (tag$ tag) (#Item value #End)))
#End))))))
- (record$ #End)
#0)
("lux def" flag_meta
@@ -821,21 +736,18 @@
(tuple$ (#Item [(meta_code ["library/lux" "Tag"] (tuple$ (#Item (text$ "library/lux") (#Item (text$ tag) #End))))
(#Item [(meta_code ["library/lux" "Bit"] (bit$ #1))
#End])]))))
- (record$ #End)
#0)
("lux def" as_def
- ("lux type check" (#Function Code (#Function Code (#Function Code (#Function Code Code))))
- (function'' [name value annotations export_policy]
- (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item annotations (#Item export_policy #End))))))))
- (record$ #End)
+ ("lux type check" (#Function Code (#Function Code (#Function Code Code)))
+ (function'' [name value export_policy]
+ (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item export_policy #End)))))))
#0)
("lux def" as_checked
("lux type check" (#Function Code (#Function Code Code))
(function'' [type value]
(form$ (#Item (text$ "lux type check") (#Item type (#Item value #End))))))
- (record$ #End)
#0)
("lux def" as_function
@@ -845,7 +757,6 @@
(#Item self
(#Item (tuple$ inputs)
(#Item output #End)))))))
- (record$ #End)
#0)
("lux def" as_macro
@@ -854,7 +765,6 @@
(form$ (#Item (text$ "lux macro")
(#Item expression
#End)))))
- (record$ #End)
#0)
("lux def" def:''
@@ -862,26 +772,20 @@
(function'' [tokens]
({(#Item [export_policy
(#Item [[_ (#Form (#Item [name args]))]
- (#Item [meta (#Item [type (#Item [body #End])])])])])
- (in_meta (#Item [(as_def name (as_checked type (as_function name args body))
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item meta
- #End)))
+ (#Item [type (#Item [body #End])])])])
+ (in_meta (#Item [(as_def name
+ (as_checked type (as_function name args body))
export_policy)
#End]))
- (#Item [export_policy (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])])
+ (#Item [export_policy (#Item [name (#Item [type (#Item [body #End])])])])
(in_meta (#Item [(as_def name (as_checked type body)
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item meta
- #End)))
export_policy)
#End]))
_
(failure "Wrong syntax for def''")}
tokens)))
- (record$ #End)
#0)
("lux def" macro:'
@@ -889,28 +793,20 @@
(function'' [tokens]
({(#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End)))
(in_meta (#Item (as_def name (as_macro (as_function name args body))
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item (tag$ ["library/lux" "End"])
- #End)))
export_policy)
#End))
- (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item meta_data (#Item body #End))))
+ (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End)))
(in_meta (#Item (as_def name (as_macro (as_function name args body))
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item meta_data
- #End)))
export_policy)
#End))
_
(failure "Wrong syntax for macro:'")}
tokens)))
- (record$ #End)
#0)
(macro:' .public (comment tokens)
- #End
(in_meta #End))
(macro:' .private ($' tokens)
@@ -929,7 +825,6 @@
tokens))
(def:'' .private (list\each f xs)
- #End
(#UnivQ #End
(#UnivQ #End
(#Function (#Function (#Parameter 3) (#Parameter 1))
@@ -943,12 +838,10 @@
xs))
(def:'' .private Replacement_Environment
- #End
Type
($' List (#Product Text Code)))
(def:'' .private (replacement_environment xs ys)
- #End
(#Function ($' List Text) (#Function ($' List Code) Replacement_Environment))
({[(#Item x xs') (#Item y ys')]
(#Item [x y] (replacement_environment xs' ys'))
@@ -958,12 +851,10 @@
[xs ys]))
(def:'' .private (text\= reference sample)
- #End
(#Function Text (#Function Text Bit))
("lux text =" reference sample))
(def:'' .private (replacement for environment)
- #End
(#Function Text (#Function Replacement_Environment ($' Maybe Code)))
({#End
#None
@@ -978,7 +869,6 @@
environment))
(def:'' .private (with_replacements reps syntax)
- #End
(#Function Replacement_Environment (#Function Code Code))
({[_ (#Identifier "" name)]
({(#Some replacement)
@@ -1007,7 +897,6 @@
syntax))
(def:'' .private (n/* param subject)
- #End
(#Function Nat (#Function Nat Nat))
("lux type as" Nat
("lux i64 *"
@@ -1015,7 +904,6 @@
("lux type as" Int subject))))
(def:'' .private (list\mix f init xs)
- #End
... (All (_ a b) (-> (-> b a a) a (List b) a))
(#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1)
(#Function (#Parameter 3)
@@ -1031,41 +919,34 @@
xs))
(def:'' .private (list\size list)
- #End
(#UnivQ #End
(#Function ($' List (#Parameter 1)) Nat))
(list\mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list))
(def:'' .private (let$ binding value body)
- #End
(#Function Code (#Function Code (#Function Code Code)))
(form$ (#Item (record$ (#Item [binding body] #End))
(#Item value #End))))
(def:'' .private (UnivQ$ body)
- #End
(#Function Code Code)
(form$ (#Item (tag$ ["library/lux" "UnivQ"]) (#Item (tag$ ["library/lux" "End"]) (#Item body #End)))))
(def:'' .private (ExQ$ body)
- #End
(#Function Code Code)
(form$ (#Item (tag$ ["library/lux" "ExQ"]) (#Item (tag$ ["library/lux" "End"]) (#Item body #End)))))
(def:'' .private quantification_level
- #End
Text
("lux text concat" double_quote
("lux text concat" "quantification_level"
double_quote)))
(def:'' .private quantified
- #End
(#Function Code Code)
(let$ (local_identifier$ ..quantification_level) (nat$ 0)))
(def:'' .private (quantified_type_parameter idx)
- #End
(#Function Nat Code)
(form$ (#Item (tag$ ["library/lux" "Parameter"])
(#Item (form$ (#Item (text$ "lux i64 +")
@@ -1075,12 +956,10 @@
#End))))
(def:'' .private (next_level depth)
- #End
(#Function Nat Nat)
("lux i64 +" 2 depth))
(def:'' .private (self_id? id)
- #End
(#Function Nat Bit)
("lux i64 =" id ("lux type as" Nat
("lux i64 *" +2
@@ -1089,7 +968,6 @@
id))))))
(def:'' .public (__adjusted_quantified_type__ permission depth type)
- #End
(#Function Nat (#Function Nat (#Function Type Type)))
({0
({... Jackpot!
@@ -1140,7 +1018,6 @@
permission))
(def:'' .private (with_correct_quantification body)
- #End
(#Function Code Code)
(form$ (#Item (identifier$ [prelude_module "__adjusted_quantified_type__"])
(#Item (local_identifier$ ..quantification_level)
@@ -1149,7 +1026,6 @@
#End))))))
(def:'' .private (with_quantification depth body)
- #End
(#Function Nat (#Function Code Code))
({g!level
(let$ g!level
@@ -1164,7 +1040,6 @@
(local_identifier$ ..quantification_level)))
(def:'' .private (initialized_quantification? lux)
- #End
(#Function Lux Bit)
({[#info _ #source _ #current_module _ #modules _
#scopes scopes #type_context _ #host _
@@ -1190,7 +1065,6 @@
lux))
(macro:' .public (All tokens lux)
- #End
({(#Item [_ (#Form (#Item self_name args))]
(#Item body #End))
(#Right [lux
@@ -1223,7 +1097,6 @@
tokens))
(macro:' .public (Ex tokens lux)
- #End
({(#Item [_ (#Form (#Item self_name args))]
(#Item body #End))
(#Right [lux
@@ -1256,7 +1129,6 @@
tokens))
(def:'' .private (list\reversed list)
- #End
(All (_ a)
(#Function ($' List a) ($' List a)))
(list\mix ("lux type check" (All (_ a)
@@ -1266,7 +1138,6 @@
list))
(macro:' .public (-> tokens)
- #End
({(#Item output inputs)
(in_meta (#Item (list\mix ("lux type check" (#Function Code (#Function Code Code))
(function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End))))))
@@ -1279,7 +1150,6 @@
(list\reversed tokens)))
(macro:' .public (list xs)
- #End
(in_meta (#Item (list\mix (function'' [head tail]
(form$ (#Item (tag$ ["library/lux" "Item"])
(#Item (tuple$ (#Item [head (#Item [tail #End])]))
@@ -1289,7 +1159,6 @@
#End)))
(macro:' .public (list& xs)
- #End
({(#Item last init)
(in_meta (list (list\mix (function'' [head tail]
(form$ (list (tag$ ["library/lux" "Item"])
@@ -1302,7 +1171,6 @@
(list\reversed xs)))
(macro:' .public (Union tokens)
- #End
({#End
(in_meta (list (identifier$ ["library/lux" "Nothing"])))
@@ -1313,7 +1181,6 @@
(list\reversed tokens)))
(macro:' .public (Tuple tokens)
- #End
({#End
(in_meta (list (identifier$ ["library/lux" "Any"])))
@@ -1352,7 +1219,7 @@
(macro:' .private (def:''' tokens)
({(#Item [export_policy
(#Item [[_ (#Form (#Item [name args]))]
- (#Item [meta (#Item [type (#Item [body #End])])])])])
+ (#Item [type (#Item [body #End])])])])
(in_meta (list (form$ (list (text$ "lux def")
name
(form$ (list (text$ "lux type check")
@@ -1361,20 +1228,14 @@
name
(tuple$ args)
body))))
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item meta
- #End)))
export_policy))))
- (#Item [export_policy (#Item [name (#Item [meta (#Item [type (#Item [body #End])])])])])
+ (#Item [export_policy (#Item [name (#Item [type (#Item [body #End])])])])
(in_meta (list (form$ (list (text$ "lux def")
name
(form$ (list (text$ "lux type check")
type
body))
- (form$ (#Item (identifier$ ["library/lux" "record$"])
- (#Item meta
- #End)))
export_policy))))
_
@@ -1382,17 +1243,14 @@
tokens))
(def:''' .public Or
- #End
Macro
..Union)
(def:''' .public And
- #End
Macro
..Tuple)
(def:''' .private (pairs xs)
- #End
(All (_ a) (-> ($' List a) ($' List (Tuple a a))))
({(#Item x (#Item y xs'))
(#Item [x y] (pairs xs'))
@@ -1417,7 +1275,6 @@
tokens))
(def:''' .private (any? p xs)
- #End
(All (_ a)
(-> (-> a Bit) ($' List a) Bit))
({#End
@@ -1430,13 +1287,11 @@
xs))
(def:''' .private (with_location content)
- #End
(-> Code Code)
(tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0)))
content)))
(def:''' .private (untemplated_list tokens)
- #End
(-> ($' List Code) Code)
({#End
(_ann (#Tag ["library/lux" "End"]))
@@ -1446,7 +1301,6 @@
tokens))
(def:''' .private (list\composite xs ys)
- #End
(All (_ a) (-> ($' List a) ($' List a) ($' List a)))
({(#Item x xs')
(#Item x (list\composite xs' ys))
@@ -1456,7 +1310,6 @@
xs))
(def:''' .private (right_associativity op a1 a2)
- #End
(-> Code Code Code Code)
({[_ (#Form parts)]
(form$ (list\composite parts (list a1 a2)))
@@ -1466,14 +1319,12 @@
op))
(def:''' .private (function\flipped func)
- #End
(All (_ a b c)
(-> (-> a b c) (-> b a c)))
(function' [right left]
(func left right)))
(macro:' .public (_$ tokens)
- #End
({(#Item op tokens')
({(#Item first nexts)
(in_meta (list (list\mix (function\flipped (right_associativity op)) first nexts)))
@@ -1487,7 +1338,6 @@
tokens))
(macro:' .public ($_ tokens)
- #End
({(#Item op tokens')
({(#Item last prevs)
(in_meta (list (list\mix (right_associativity op) last prevs)))
@@ -1515,12 +1365,10 @@
(-> (-> a ($' ! b))
($' ! a)
($' ! b))))))
- (record$ (list))
["in" "then"]
#0)
(def:''' .private maybe_monad
- #End
($' Monad Maybe)
[#in
(function' [x] (#Some x))
@@ -1532,7 +1380,6 @@
ma))])
(def:''' .private meta_monad
- #End
($' Monad Meta)
[#in
(function' [x]
@@ -1584,7 +1431,6 @@
tokens))
(def:''' .private (monad\each m f xs)
- #End
(All (_ m a b)
(-> ($' Monad m)
(-> a ($' m b))
@@ -1602,7 +1448,6 @@
xs)))
(def:''' .private (monad\mix m f y xs)
- #End
(All (_ m a b)
(-> ($' Monad m)
(-> a b ($' m b))
@@ -1620,7 +1465,6 @@
xs)))
(macro:' .public (if tokens)
- (list)
({(#Item test (#Item then (#Item else #End)))
(in_meta (list (form$ (list (record$ (list [(bit$ #1) then]
[(bit$ #0) else]))
@@ -1631,12 +1475,10 @@
tokens))
(def:''' .private PList
- #End
Type
(All (_ a) ($' List (Tuple Text a))))
(def:''' .private (plist\value k plist)
- #End
(All (_ a)
(-> Text ($' PList a) ($' Maybe a)))
({(#Item [[k' v] plist'])
@@ -1649,12 +1491,10 @@
plist))
(def:''' .private (text\composite x y)
- #End
(-> Text Text Text)
("lux text concat" x y))
(def:''' .private (name\encoded full_name)
- #End
(-> Name Text)
(let' [[module name] full_name]
({"" name
@@ -1662,7 +1502,6 @@
module)))
(def:''' .private (global_identifier full_name state)
- #End
(-> Name ($' Meta Name))
(let' [[module name] full_name
[#info info #source source #current_module _ #modules modules
@@ -1674,7 +1513,7 @@
({(#Alias real_name)
(#Right [state real_name])
- (#Definition [exported? def_type def_meta def_value])
+ (#Definition [exported? def_type def_value])
(#Right [state full_name])
(#Type [exported? type labels])
@@ -1696,7 +1535,6 @@
(plist\value module modules))))
(def:''' .private (code_list expression)
- #End
(-> Code Code)
(let' [type (form$ (list (tag$ ["library/lux" "Apply"])
(identifier$ ["library/lux" "Code"])
@@ -1704,7 +1542,6 @@
(form$ (list (text$ "lux type check") type expression))))
(def:''' .private (spliced replace? untemplated elems)
- #End
(-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code))
({#1
({#End
@@ -1744,12 +1581,10 @@
replace?))
(def:''' .private (untemplated_text value)
- #End
(-> Text Code)
(with_location (form$ (list (tag$ ["library/lux" "Text"]) (text$ value)))))
(def:''' .private (untemplated replace? subst token)
- #End
(-> Bit Text Code ($' Meta Code))
({[_ [_ (#Bit value)]]
(in_meta (with_location (form$ (list (tag$ ["library/lux" "Bit"]) (bit$ value)))))
@@ -1840,7 +1675,6 @@
[replace? token]))
(macro:' .public (primitive tokens)
- (list)
({(#Item [_ (#Text class_name)] #End)
(in_meta (list (form$ (list (tag$ ["library/lux" "Primitive"]) (text$ class_name) (tag$ ["library/lux" "End"])))))
@@ -1852,7 +1686,6 @@
tokens))
(def:'' .private (current_module_name state)
- #End
($' Meta Text)
({[#info info #source source #current_module current_module #modules modules
#scopes scopes #type_context types #host host
@@ -1867,7 +1700,6 @@
state))
(macro:' .public (` tokens)
- (list)
({(#Item template #End)
(do meta_monad
[current_module current_module_name
@@ -1881,7 +1713,6 @@
tokens))
(macro:' .public (`' tokens)
- (list)
({(#Item template #End)
(do meta_monad
[=template (untemplated #1 "" template)]
@@ -1892,7 +1723,6 @@
tokens))
(macro:' .public (' tokens)
- (list)
({(#Item template #End)
(do meta_monad
[=template (untemplated #0 "" template)]
@@ -1903,7 +1733,6 @@
tokens))
(macro:' .public (|> tokens)
- (list)
({(#Item [init apps])
(in_meta (list (list\mix ("lux type check" (-> Code Code Code)
(function' [app acc]
@@ -1924,7 +1753,6 @@
tokens))
(macro:' .public (<| tokens)
- (list)
({(#Item [init apps])
(in_meta (list (list\mix ("lux type check" (-> Code Code Code)
(function' [app acc]
@@ -1945,14 +1773,11 @@
(list\reversed tokens)))
(def:''' .private (function\composite f g)
- (list [(tag$ ["library/lux" "doc"])
- (text$ "Function composition.")])
(All (_ a b c)
(-> (-> b c) (-> a b) (-> a c)))
(function' [x] (f (g x))))
(def:''' .private (identifier_name x)
- #End
(-> Code ($' Maybe Name))
({[_ (#Identifier sname)]
(#Some sname)
@@ -1962,7 +1787,6 @@
x))
(def:''' .private (tag_name x)
- #End
(-> Code ($' Maybe Name))
({[_ (#Tag sname)]
(#Some sname)
@@ -1972,7 +1796,6 @@
x))
(def:''' .private (identifier_short x)
- #End
(-> Code ($' Maybe Text))
({[_ (#Identifier "" sname)]
(#Some sname)
@@ -1982,7 +1805,6 @@
x))
(def:''' .private (tuple_list tuple)
- #End
(-> Code ($' Maybe ($' List Code)))
({[_ (#Tuple members)]
(#Some members)
@@ -1992,7 +1814,6 @@
tuple))
(def:''' .private (realized_template env template)
- #End
(-> Replacement_Environment Code Code)
({[_ (#Identifier "" sname)]
({(#Some subst)
@@ -2020,28 +1841,23 @@
template))
(def:''' .private (every? p xs)
- #End
(All (_ a)
(-> (-> a Bit) ($' List a) Bit))
(list\mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs))
(def:''' .private (high_bits value)
- (list)
(-> ($' I64 Any) I64)
("lux i64 right-shift" 32 value))
(def:''' .private low_mask
- (list)
I64
(|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1)))
(def:''' .private (low_bits value)
- (list)
(-> ($' I64 Any) I64)
("lux i64 and" low_mask value))
(def:''' .private (n/< reference sample)
- (list)
(-> Nat Nat Bit)
(let' [referenceH (high_bits reference)
sampleH (high_bits sample)]
@@ -2054,13 +1870,11 @@
#0))))
(def:''' .private (list\conjoint xs)
- #End
(All (_ a)
(-> ($' List ($' List a)) ($' List a)))
(list\mix list\composite #End (list\reversed xs)))
(macro:' .public (template tokens)
- (list)
({(#Item [[_ (#Tuple bindings)] (#Item [[_ (#Tuple templates)] data])])
({[(#Some bindings') (#Some data')]
(let' [apply ("lux type check" (-> Replacement_Environment ($' List Code))
@@ -2084,7 +1898,6 @@
tokens))
(def:''' .private (n// param subject)
- (list)
(-> Nat Nat Nat)
(if ("lux i64 <" +0 ("lux type as" Int param))
(if (n/< param subject)
@@ -2103,7 +1916,6 @@
("lux i64 +" 1 quotient)))))
(def:''' .private (n/% param subject)
- (list)
(-> Nat Nat Nat)
(let' [flat ("lux i64 *"
("lux type as" Int param)
@@ -2111,19 +1923,16 @@
("lux i64 -" flat subject)))
(def:''' .private (n/min left right)
- (list)
(-> Nat Nat Nat)
(if (n/< right left)
left
right))
(def:''' .private (bit\encoded x)
- #End
(-> Bit Text)
(if x "#1" "#0"))
(def:''' .private (digit::format digit)
- #End
(-> Nat Text)
({0 "0"
1 "1" 2 "2" 3 "3"
@@ -2133,7 +1942,6 @@
digit))
(def:''' .private (nat\encoded value)
- #End
(-> Nat Text)
({0
"0"
@@ -2150,14 +1958,12 @@
value))
(def:''' .private (int\abs value)
- #End
(-> Int Int)
(if ("lux i64 <" +0 value)
("lux i64 *" -1 value)
value))
(def:''' .private (int\encoded value)
- #End
(-> Int Text)
(if ("lux i64 =" +0 value)
"+0"
@@ -2175,22 +1981,18 @@
(|> value ("lux i64 %" +10) int\abs ("lux type as" Nat) digit::format)))))
(def:''' .private (frac\encoded x)
- #End
(-> Frac Text)
("lux f64 encode" x))
(def:''' .private (multiple? div n)
- #End
(-> Nat Nat Bit)
(|> n (n/% div) ("lux i64 =" 0)))
(def:''' .public (not x)
- (list)
(-> Bit Bit)
(if x #0 #1))
(def:''' .private (macro_type? type)
- (list)
(-> Type Bit)
({(#Named ["library/lux" "Macro"] (#Primitive "#Macro" #End))
#1
@@ -2200,7 +2002,6 @@
type))
(def:''' .private (macro'' modules current_module module name)
- #End
(-> ($' List (Tuple Text Module))
Text Text Text
($' Maybe Macro))
@@ -2211,7 +2012,7 @@
({(#Alias [r_module r_name])
(macro'' modules current_module r_module r_name)
- (#Definition [exported? def_type def_meta def_value])
+ (#Definition [exported? def_type def_value])
(if (macro_type? def_type)
(if exported?
(#Some ("lux type as" Macro def_value))
@@ -2231,7 +2032,6 @@
("lux type check" Global gdef))))
(def:''' .private (normal name)
- #End
(-> Name ($' Meta Name))
({["" name]
(do meta_monad
@@ -2243,7 +2043,6 @@
name))
(def:''' .private (macro' full_name)
- #End
(-> Name ($' Meta ($' Maybe Macro)))
(do meta_monad
[current_module current_module_name]
@@ -2258,7 +2057,6 @@
state)))))
(def:''' .private (macro? name)
- #End
(-> Name ($' Meta Bit))
(do meta_monad
[name (normal name)
@@ -2268,7 +2066,6 @@
output))))
(def:''' .private (list\interposed sep xs)
- #End
(All (_ a)
(-> a ($' List a) ($' List a)))
({#End
@@ -2282,7 +2079,6 @@
xs))
(def:''' .private (single_expansion token)
- #End
(-> Code ($' Meta ($' List Code)))
({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
@@ -2292,7 +2088,7 @@
(("lux type as" Macro' macro) args)
#None
- (in_meta (list token))}
+ (in (list token))}
?macro))
_
@@ -2300,7 +2096,6 @@
token))
(def:''' .private (expansion token)
- #End
(-> Code ($' Meta ($' List Code)))
({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
@@ -2313,7 +2108,7 @@
(in (list\conjoint recursive_expansion)))
#None
- (in_meta (list token))}
+ (in (list token))}
?macro))
_
@@ -2321,7 +2116,6 @@
token))
(def:''' .private (full_expansion syntax)
- #End
(-> Code ($' Meta ($' List Code)))
({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
@@ -2370,12 +2164,10 @@
syntax))
(def:''' .private (text\encoded original)
- #End
(-> Text Text)
($_ text\composite ..double_quote original ..double_quote))
(def:''' .private (code\encoded code)
- #End
(-> Code Text)
({[_ (#Bit value)]
(bit\encoded value)
@@ -2429,7 +2221,6 @@
code))
(def:''' .private (normal_type type)
- #End
(-> Code Code)
({[_ (#Form (#Item [_ (#Tag tag)] parts))]
(form$ (#Item (tag$ tag) (list\each normal_type parts)))
@@ -2475,7 +2266,6 @@
type))
(macro:' .public (type tokens)
- (list)
({(#Item type #End)
(do meta_monad
[initialized_quantification? (function' [lux] (#Right [lux (initialized_quantification? lux)]))]
@@ -2495,7 +2285,6 @@
tokens))
(macro:' .public (: tokens)
- (list)
({(#Item type (#Item value #End))
(in_meta (list (` ("lux type check"
(..type (~ type))
@@ -2506,7 +2295,6 @@
tokens))
(macro:' .public (:as tokens)
- (list)
({(#Item type (#Item value #End))
(in_meta (list (` ("lux type as"
(..type (~ type))
@@ -2517,7 +2305,6 @@
tokens))
(def:''' .private (empty? xs)
- #End
(All (_ a)
(-> ($' List a) Bit))
({#End #1
@@ -2526,7 +2313,6 @@
(template [<name> <type> <value>]
[(def:''' .private (<name> xy)
- #End
(All (_ a b)
(-> (Tuple a b) <type>))
(let' [[x y] xy]
@@ -2536,7 +2322,6 @@
[product\right b y])
(def:''' .private (identifier prefix state)
- #End
(-> Text ($' Meta Code))
({[#info info #source source #current_module _ #modules modules
#scopes scopes #type_context types #host host
@@ -2552,7 +2337,6 @@
state))
(macro:' .public (exec tokens)
- (list)
({(#Item value actions)
(let' [dummy (local_identifier$ "")]
(in_meta (list (list\mix ("lux type check" (-> Code Code Code)
@@ -2597,8 +2381,6 @@
?type)]
(in_meta (list (` ("lux def" (~ name)
(~ body'')
- [(~ location_code)
- (#.Record #.End)]
(~ export_policy))))))
#None
@@ -2639,7 +2421,6 @@
branches))
(macro:' .public (case tokens)
- (list)
({(#Item value branches)
(do meta_monad
[expansion (expander branches)]
@@ -2650,7 +2431,6 @@
tokens))
(macro:' .public (^ tokens)
- (list)
(case tokens
(#Item [_ (#Form (#Item pattern #End))] (#Item body branches))
(do meta_monad
@@ -2666,7 +2446,6 @@
(failure "Wrong syntax for ^ macro")))
(macro:' .public (^or tokens)
- (list)
(case tokens
(^ (list& [_ (#Form patterns)] body branches))
(case patterns
@@ -2691,7 +2470,6 @@
#0))
(macro:' .public (let tokens)
- (list)
(case tokens
(^ (list [_ (#Tuple bindings)] body))
(if (multiple? 2 (list\size bindings))
@@ -2711,7 +2489,6 @@
(failure "Wrong syntax for let")))
(macro:' .public (function tokens)
- (list)
(case (: (Maybe [Text Code (List Code) Code])
(case tokens
(^ (list [_ (#Form (list& [_ (#Identifier ["" name])] head tail))] body))
@@ -2734,57 +2511,6 @@
#None
(failure "Wrong syntax for function")))
-(def:' .private (definition_annotation_value code)
- (-> Code Code)
- (case code
- [_ (#Bit value)]
- (meta_code ["library/lux" "Bit"] (bit$ value))
-
- [_ (#Nat value)]
- (meta_code ["library/lux" "Nat"] (nat$ value))
-
- [_ (#Int value)]
- (meta_code ["library/lux" "Int"] (int$ value))
-
- [_ (#Rev value)]
- (meta_code ["library/lux" "Rev"] (rev$ value))
-
- [_ (#Frac value)]
- (meta_code ["library/lux" "Frac"] (frac$ value))
-
- [_ (#Text value)]
- (meta_code ["library/lux" "Text"] (text$ value))
-
- [_ (#Tag [module name])]
- (meta_code ["library/lux" "Tag"] (` [(~ (text$ module)) (~ (text$ name))]))
-
- (^or [_ (#Form _)] [_ (#Identifier _)])
- code
-
- [_ (#Tuple xs)]
- (|> xs
- (list\each definition_annotation_value)
- untemplated_list
- (meta_code ["library/lux" "Tuple"]))
-
- [_ (#Record kvs)]
- (|> kvs
- (list\each (: (-> [Code Code] Code)
- (function (_ [k v])
- (` [(~ (definition_annotation_value k))
- (~ (definition_annotation_value v))]))))
- untemplated_list
- (meta_code ["library/lux" "Record"]))
- ))
-
-(def:' .private (definition_annotations kvs)
- (-> (List [Code Code]) Code)
- (untemplated_list (list\each (: (-> [Code Code] Code)
- (function (_ [k v])
- (` [(~ (definition_annotation_value k))
- (~ (definition_annotation_value v))])))
- kvs)))
-
(def:' .private (endP tokens)
(-> (List Code) (Maybe Any))
(case tokens
@@ -2851,12 +2577,31 @@
[enhanced_local_declarationP Code enhanced_parametersP]
)
+(def:' .private (export_policyP tokens)
+ (-> (List Code) [(List Code) Code])
+ (case tokens
+ (^ (list& candidate tokens'))
+ (case candidate
+ [_ (#Bit it)]
+ [tokens' candidate]
+
+ [_ (#Identifier ["" _])]
+ [tokens (` .private)]
+
+ [_ (#Identifier it)]
+ [tokens' candidate]
+
+ _
+ [tokens (` .private)])
+
+ _
+ [tokens (` .private)]))
+
(template [<parser> <parameter_type> <local>]
[(def:' .private (<parser> tokens)
(-> (List Code) (Maybe [(List Code) [Code Text (List <parameter_type>)]]))
(do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
+ [.let' [[tokens export_policy] (export_policyP tokens)]
% (<local> tokens)
.let' [[tokens [name parameters]] %]]
(in [tokens [export_policy name parameters]])))]
@@ -2865,15 +2610,6 @@
[enhanced_declarationP Code enhanced_local_declarationP]
)
-(def:' .private (annotationsP tokens)
- (-> (List Code) (Maybe [(List Code) (List [Code Code])]))
- (case tokens
- (^ (list& [_ (#Record annotations)] tokens'))
- (#Some [tokens' annotations])
-
- tokens'
- #None))
-
(def:' .private (bodyP tokens)
(-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]]))
(case tokens
@@ -2888,71 +2624,19 @@
_
#None))
-(macro:' .private (maybe\else' tokens)
- (case tokens
- (^ (list else then))
- (do meta_monad
- [g!_ (..identifier "g!_")]
- (in (list (` (..case (~ then)
- (#..Some (~ g!_))
- (#..Some (~ g!_))
-
- #..None
- (~ else))))))
-
- _
- (failure "Wrong syntax for maybe\else'")))
-
(def:' .private (definitionP tokens)
- (-> (List Code) (Maybe [Code Text (List Code) (List [Code Code]) (Maybe Code) Code]))
- (|> (do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
- % (enhanced_local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (bodyP tokens)
- .let' [[tokens [?type body]] %]
- _ (endP tokens)]
- (in [export_policy name parameters annotations ?type body]))
- ... (^ (list _export_policy _declaration _annotations _type _body))
- ... (^ (list _export_policy _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (enhanced_local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (bodyP tokens)
- .let' [[tokens [?type body]] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters #End ?type body])))
- ... (^ (list _declaration _type _body))
- ... (^ (list _declaration _body))
- (maybe\else' (do maybe_monad
- [% (enhanced_local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (bodyP tokens)
- .let' [[tokens [?type body]] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters annotations ?type body])))
- ... (^ (list _declaration _annotations _type _body))
- ... (^ (list _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (enhanced_declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
- % (bodyP tokens)
- .let' [[tokens [?type body]] %]
- _ (endP tokens)]
- (in [export_policy name parameters #End ?type body])))
- ... (^ (list _export_policy _declaration _type _body))
- ... (^ (list _export_policy _declaration _body))
- ))
+ (-> (List Code) (Maybe [Code Text (List Code) (Maybe Code) Code]))
+ (do maybe_monad
+ [% (enhanced_declarationP tokens)
+ .let' [[tokens [export_policy name parameters]] %]
+ % (bodyP tokens)
+ .let' [[tokens [?type body]] %]
+ _ (endP tokens)]
+ (in [export_policy name parameters ?type body])))
(macro:' .public (def: tokens)
- (list)
(case (definitionP tokens)
- (#Some [export_policy name parameters annotations ?type body])
+ (#Some [export_policy name parameters ?type body])
(let [body (case parameters
#End
body
@@ -2966,63 +2650,27 @@
(~ body)))
#None
- body)
- =annotations (definition_annotations annotations)]
+ body)]
(in_meta (list (` ("lux def" (~ (..local_identifier$ name))
(~ body)
- [(~ location_code)
- (#.Record (~ =annotations))]
(~ export_policy))))))
#None
(failure "Wrong syntax for def:")))
(def:' .private (macroP tokens)
- (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) Code]))
- (|> (do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
- % (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (anyP tokens)
- .let' [[tokens body] %]
- _ (endP tokens)]
- (in [export_policy name parameters annotations body]))
- ... (^ (list _export_policy _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (anyP tokens)
- .let' [[tokens body] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters #End body])))
- ... (^ (list _declaration _body))
- (maybe\else' (do maybe_monad
- [% (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (anyP tokens)
- .let' [[tokens body] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters annotations body])))
- ... (^ (list _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
- % (anyP tokens)
- .let' [[tokens body] %]
- _ (endP tokens)]
- (in [export_policy name parameters #End body])))
- ... (^ (list _export_policy _declaration _body))
- ))
+ (-> (List Code) (Maybe [Code Text (List Text) Code]))
+ (do maybe_monad
+ [% (declarationP tokens)
+ .let' [[tokens [export_policy name parameters]] %]
+ % (anyP tokens)
+ .let' [[tokens body] %]
+ _ (endP tokens)]
+ (in [export_policy name parameters body])))
(macro:' .public (macro: tokens)
- (list)
(case (macroP tokens)
- (#Some [export_policy name args annotations body])
+ (#Some [export_policy name args body])
(let [name (local_identifier$ name)
body (case args
#End
@@ -3030,12 +2678,9 @@
_
(` ("lux macro"
- (function ((~ name) (~+ (list\each local_identifier$ args))) (~ body)))))
- =annotations (definition_annotations annotations)]
+ (function ((~ name) (~+ (list\each local_identifier$ args))) (~ body)))))]
(in_meta (list (` ("lux def" (~ name)
(~ body)
- [(~ location_code)
- (#Record (~ =annotations))]
(~ export_policy))))))
#None
@@ -3384,7 +3029,7 @@
(: (-> Code (Meta (List Code)))
(function (_ token)
(case token
- (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag_name)] value meta export_policy))])
+ (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier ["" tag_name])] value export_policy))])
(case (plist\value tag_name tag_mappings)
(#Some tag)
(in (list tag value))
@@ -3419,41 +3064,18 @@
(#Item tokens)))
(def: (implementationP tokens)
- (-> (List Code) (Maybe [Code Text (List Code) (List [Code Code]) Code (List Code)]))
- (|> (do maybe_monad
- [% (enhanced_declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (anyP tokens)
- .let' [[tokens type] %]
- tokens (remainderP tokens)]
- (in [export_policy name parameters annotations type tokens]))
- ... (^ (list _export_policy _declaration _annotations _type _body))
- ... (^ (list _declaration _annotations _type _body))
- (maybe\else' (do maybe_monad
- [% (enhanced_local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (anyP tokens)
- .let' [[tokens type] %]
- tokens (remainderP tokens)]
- (in [(` ..private) name parameters #End type tokens])))
- ... (^ (list _declaration _type _body))
- (maybe\else' (do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
- % (enhanced_local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (anyP tokens)
- .let' [[tokens type] %]
- tokens (remainderP tokens)]
- (in [export_policy name parameters #End type tokens])))
- ... (^ (list _export_policy _declaration _type _body))
- ))
+ (-> (List Code) (Maybe [Code Text (List Code) Code (List Code)]))
+ (do maybe_monad
+ [% (enhanced_declarationP tokens)
+ .let' [[tokens [export_policy name parameters]] %]
+ % (anyP tokens)
+ .let' [[tokens type] %]
+ tokens (remainderP tokens)]
+ (in [export_policy name parameters type tokens])))
(macro: .public (implementation: tokens)
(case (implementationP tokens)
- (#Some [export_policy name args annotations type definitions])
+ (#Some [export_policy name args type definitions])
(let [usage (case args
#End
(local_identifier$ name)
@@ -3461,9 +3083,9 @@
_
(` ((~ (local_identifier$ name)) (~+ args))))]
(in_meta (list (` (..def: (~ export_policy) (~ usage)
- (~ (record$ annotations))
(~ type)
- (implementation (~+ definitions)))))))
+ (implementation
+ (~+ definitions)))))))
#None
(failure "Wrong syntax for implementation:")))
@@ -3542,48 +3164,14 @@
(failure "Wrong syntax for Record")))
(def: (typeP tokens)
- (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) Code]))
- (|> (do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
- % (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (anyP tokens)
- .let' [[tokens definition] %]
- _ (endP tokens)]
- (in [export_policy name parameters annotations definition]))
- ... (^ (list _export_policy _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (anyP tokens)
- .let' [[tokens definition] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters annotations definition])))
- ... (^ (list _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (anyP tokens)
- .let' [[tokens definition] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters #End definition])))
- ... (^ (list _declaration _body))
- (maybe\else' (do maybe_monad
- [% (anyP tokens)
- .let' [[tokens export_policy] %]
- % (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (anyP tokens)
- .let' [[tokens definition] %]
- _ (endP tokens)]
- (in [export_policy name parameters #End definition])))
- ... (^ (list _export_policy _declaration _body))
- ))
+ (-> (List Code) (Maybe [Code Text (List Text) Code]))
+ (do maybe_monad
+ [% (declarationP tokens)
+ .let' [[tokens [export_policy name parameters]] %]
+ % (anyP tokens)
+ .let' [[tokens definition] %]
+ _ (endP tokens)]
+ (in [export_policy name parameters definition])))
(def: (textP tokens)
(-> (List Code) (Maybe [(List Code) Text]))
@@ -3628,7 +3216,7 @@
(macro: .public (type: tokens)
(case (typeP tokens)
- (#Some [export_policy name args meta type_codes])
+ (#Some [export_policy name args type_codes])
(do meta_monad
[type+labels?? (..type_declaration type_codes)
module_name current_module_name
@@ -3641,10 +3229,7 @@
_
(#Some (` (.All ((~ type_name) (~+ (list\each local_identifier$ args)))
- (~ type))))))
- total_meta (let [meta (definition_annotations meta)]
- (` [(~ location_code)
- (#.Record (~ meta))]))]]
+ (~ type))))))]]
(case type'
(#Some type'')
(let [typeC (` (#.Named [(~ (text$ module_name))
@@ -3656,14 +3241,12 @@
(#Left tags)
(` ("lux def type tagged" (~ type_name)
(~ typeC)
- (~ total_meta)
((~+ (list\each text$ tags)))
(~ export_policy)))
(#Right slots)
(` ("lux def type tagged" (~ type_name)
(~ typeC)
- (~ total_meta)
[(~+ (list\each text$ slots))]
(~ export_policy))))
@@ -3671,7 +3254,6 @@
(` ("lux def" (~ type_name)
("lux type check type"
(~ typeC))
- (~ total_meta)
(~ export_policy)))))))
#None
@@ -3983,7 +3565,7 @@
(#Alias _)
(list)
- (#Definition [exported? def_type def_meta def_value])
+ (#Definition [exported? def_type def_value])
(if exported?
(list name)
(list))
@@ -4090,7 +3672,7 @@
(#Alias real_name)
(definition_type real_name state)
- (#Definition [exported? def_type def_meta def_value])
+ (#Definition [exported? def_type def_value])
(#Some def_type)
(#Type [exported? type labels])
@@ -4123,7 +3705,7 @@
(#Alias real_name)
(definition_value real_name state)
- (#Definition [exported? def_type def_meta def_value])
+ (#Definition [exported? def_type def_value])
(#Right [state [def_type def_value]])
(#Type [exported? type labels])
@@ -4346,7 +3928,6 @@
_
(in_meta (list (` ("lux def" (~ (local_identifier$ (..module_alias (list short) alias)))
(~ source+)
- [(~ location_code) (#.Record #.End)]
#0)))))))
(macro: .public (open: tokens)
@@ -4373,9 +3954,7 @@
_
(do meta_monad
[g!struct (..identifier "struct")]
- (in_meta (list (` ("lux def" (~ g!struct) (~ struct)
- [(~ location_code) (#.Record #.End)]
- #0))
+ (in_meta (list (` ("lux def" (~ g!struct) (~ struct) #0))
(` (..open: (~ (text$ alias)) (~ g!struct)))))))
_
@@ -5195,39 +4774,18 @@
#None))
(def: (templateP tokens)
- (-> (List Code) (Maybe [Code Text (List Text) (List [Code Code]) (List Code)]))
- (|> (do maybe_monad
- [% (declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
- % (annotationsP tokens)
- .let' [[tokens annotations] %]
- % (tupleP tokens)
- .let' [[tokens templates] %]
- _ (endP tokens)]
- (in [export_policy name parameters annotations templates]))
- ... (^ (list _export_policy _declaration _annotations _body))
- ... (^ (list _declaration _annotations _body))
- (maybe\else' (do maybe_monad
- [% (declarationP tokens)
- .let' [[tokens [export_policy name parameters]] %]
- % (tupleP tokens)
- .let' [[tokens templates] %]
- _ (endP tokens)]
- (in [export_policy name parameters #End templates])))
- ... (^ (list _export_policy _declaration _body))
- (maybe\else' (do maybe_monad
- [% (local_declarationP tokens)
- .let' [[tokens [name parameters]] %]
- % (tupleP tokens)
- .let' [[tokens templates] %]
- _ (endP tokens)]
- (in [(` ..private) name parameters #End templates])))
- ... (^ (list _declaration _body))
- ))
+ (-> (List Code) (Maybe [Code Text (List Text) (List Code)]))
+ (do maybe_monad
+ [% (declarationP tokens)
+ .let' [[tokens [export_policy name parameters]] %]
+ % (tupleP tokens)
+ .let' [[tokens templates] %]
+ _ (endP tokens)]
+ (in [export_policy name parameters templates])))
(macro: .public (template: tokens)
(case (templateP tokens)
- (#Some [export_policy name args anns input_templates])
+ (#Some [export_policy name args input_templates])
(do meta_monad
[g!tokens (..identifier "tokens")
g!compiler (..identifier "compiler")
@@ -5238,7 +4796,6 @@
this_module current_module_name]
(in (list (` (macro: (~ export_policy)
((~ (local_identifier$ name)) (~ g!tokens) (~ g!compiler))
- (~ (record$ anns))
(case (~ g!tokens)
(^ (list (~+ (list\each local_identifier$ args))))
(#.Right [(~ g!compiler)
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index ee8cc8af9..24883f901 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -15,7 +15,7 @@
["[0]" code]
["[0]" template]
[syntax {"+" [syntax:]}
- ["|[0]|" annotations]]]
+ ["|[0]|" export]]]
[math
[number
["n" nat]
@@ -115,21 +115,15 @@
(in (list (` (|> (~! ..begin!) (~+ commands) ((~! ..end!)))))))
(def: word
- (Parser [Code Text |annotations|.Annotations Code (List Code)])
- (let [private (: (Parser [Text |annotations|.Annotations Code (List Code)])
- ($_ <>.and
- <code>.local_identifier
- (<>.else |annotations|.empty |annotations|.parser)
- <code>.any
- (<>.many <code>.any)))]
- ($_ <>.either
- (<>.and <code>.any private)
- (<>.and (<>\in (` .private)) private)
- )))
-
-(syntax: .public (word: [[export_policy name annotations type commands] ..word])
+ (Parser [Code Text Code (List Code)])
+ (|export|.parser
+ ($_ <>.and
+ <code>.local_identifier
+ <code>.any
+ (<>.many <code>.any))))
+
+(syntax: .public (word: [[export_policy name type commands] ..word])
(in (list (` (def: (~ export_policy) (~ (code.local_identifier name))
- (~ (|annotations|.format annotations))
(~ type)
(|>> (~+ commands)))))))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 5dfe95fce..10cf2c203 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -28,8 +28,8 @@
(type: .public ID selector.ID)
(type: .public Class selector.Class)
+... Attributes for an HTML tag.
(type: .public Attributes
- {#.doc "Attributes for an HTML tag."}
(List [Text Text]))
(type: .public Script
@@ -52,8 +52,8 @@
#Top "_top"
(#Frame name) name))
+... Properly formats text to ensure no injection can happen on the HTML.
(def: safe
- {#.doc "Properly formats text to ensure no injection can happen on the HTML."}
(-> Text Text)
(|>> (text.replaced "&" "&amp;")
(text.replaced "<" "&lt;")
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 93ec06334..163bb3b20 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -140,20 +140,20 @@
(text.interposed text.new_line)
..block))
+ ... A snippet of code.
(def: .public snippet
- {#.doc "A snippet of code."}
(-> Text (Markdown Span))
(|>> (text.enclosed ["`` " " ``"]) :abstraction))
+ ... A (generic) block of code.
(def: .public generic_code
- {#.doc "A (generic) block of code."}
(-> Text (Markdown Block))
(let [open (format "```" text.new_line)
close (format text.new_line "```")]
(|>> (text.enclosed [open close]) ..block)))
+ ... A block of code of a specific language.
(def: .public (code language block)
- {#.doc "A block of code of a specific language."}
(-> Text Text (Markdown Block))
(let [open (format "```" language text.new_line)
close (format text.new_line "```")]
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 64df69b6d..9ee1db78d 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -518,7 +518,7 @@
[[name parameters] ..declaration])
(do meta.monad
[.let [g!module (code.text (product.left name))]
- [[_ def_type def_annotations def_value]] (meta.export name)
+ [[_ def_type def_value]] (meta.export name)
tags (meta.tags_of name)]
(with_expansions [<\n> (~! text.\n)]
(macro.with_identifiers [g!type]
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index be7835ad0..e1b4e93bb 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -1312,7 +1312,6 @@
params' (list\each ..var$' params)]
(template.with_locals [g!_]
(` (def: (~ (code.identifier ["" def_name]))
- {#..jvm_class (~ (code.text (..internal full_name)))}
.Type
(All ((~ (' g!_)) (~+ params'))
(primitive (~ (code.text full_name))
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index b4dac8f03..91f5b598c 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -217,8 +217,8 @@
(~+ (list\each (with_nil g!temp) g!inputs)))))))))))
(syntax: .public (import: [import ..import])
- {#.doc (example "Easily import types, methods, functions and constants."
- (import: (os/getenv [..String] "io" "?" ..String)))}
+ ... {#.doc (example "Easily import types, methods, functions and constants."
+ ... (import: (os/getenv [..String] "io" "?" ..String)))}
(with_identifiers [g!temp]
(case import
(#Class [class format members])
@@ -309,11 +309,11 @@
)))
(template: .public (closure <inputs> <output>)
- {#.doc (example "Allows defining closures/anonymous-functions in the form that Lua expects."
- "This is useful for adapting Lux functions for usage by Lua code."
- (: ..Function
- (closure [left right]
- (do_something (:as Foo left) (:as Bar right)))))}
+ ... {#.doc (example "Allows defining closures/anonymous-functions in the form that Lua expects."
+ ... "This is useful for adapting Lux functions for usage by Lua code."
+ ... (: ..Function
+ ... (closure [left right]
+ ... (do_something (:as Foo left) (:as Bar right)))))}
[(.:as ..Function
(`` ("lua function"
(~~ (template.amount <inputs>))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index ea8b13a7c..c24e49deb 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -1295,7 +1295,6 @@
(let [params' (list\each (|>> product.left code.local_identifier) params)]
(template.with_locals [g!_]
(` (def: (~ (code.identifier ["" full_name]))
- {#..jvm_class (~ (code.text full_name))}
Type
(All ((~ (' g!_)) (~+ params'))
(primitive (~ (code.text (safe full_name)))
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index 095b1b754..78d75f269 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -187,12 +187,12 @@
))
(syntax: .public (try [expression <code>.any])
- {#.doc (example (case (try (risky_computation input))
- (#.Right success)
- (do_something success)
+ ... {#.doc (example (case (try (risky_computation input))
+ ... (#.Right success)
+ ... (do_something success)
- (#.Left error)
- (recover_from_failure error)))}
+ ... (#.Left error)
+ ... (recover_from_failure error)))}
(in (list (` ("lux try" ((~! io.io) (~ expression)))))))
(def: (with_io with? without)
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index d0ac65ba0..d5f1e23a2 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -217,28 +217,28 @@
(~+ (list\each (with_none g!temp) g!inputs)))))))))))
(syntax: .public (import: [import ..import])
- {#.doc (example "Easily import types, methods, functions and constants."
- (import: os
- ["[1]::[0]"
- ("static" F_OK ..Integer)
- ("static" R_OK ..Integer)
- ("static" W_OK ..Integer)
- ("static" X_OK ..Integer)
-
- ("static" mkdir [..String] "io" "try" "?" Any)
- ("static" access [..String ..Integer] "io" "try" ..Boolean)
- ("static" remove [..String] "io" "try" "?" Any)
- ("static" rmdir [..String] "io" "try" "?" Any)
- ("static" rename [..String ..String] "io" "try" "?" Any)
- ("static" listdir [..String] "io" "try" (Array ..String))])
-
- (import: os/path
- ["[1]::[0]"
- ("static" isfile [..String] "io" "try" ..Boolean)
- ("static" isdir [..String] "io" "try" ..Boolean)
- ("static" sep ..String)
- ("static" getsize [..String] "io" "try" ..Integer)
- ("static" getmtime [..String] "io" "try" ..Float)]))}
+ ... {#.doc (example "Easily import types, methods, functions and constants."
+ ... (import: os
+ ... ["[1]::[0]"
+ ... ("static" F_OK ..Integer)
+ ... ("static" R_OK ..Integer)
+ ... ("static" W_OK ..Integer)
+ ... ("static" X_OK ..Integer)
+
+ ... ("static" mkdir [..String] "io" "try" "?" Any)
+ ... ("static" access [..String ..Integer] "io" "try" ..Boolean)
+ ... ("static" remove [..String] "io" "try" "?" Any)
+ ... ("static" rmdir [..String] "io" "try" "?" Any)
+ ... ("static" rename [..String ..String] "io" "try" "?" Any)
+ ... ("static" listdir [..String] "io" "try" (Array ..String))])
+
+ ... (import: os/path
+ ... ["[1]::[0]"
+ ... ("static" isfile [..String] "io" "try" ..Boolean)
+ ... ("static" isdir [..String] "io" "try" ..Boolean)
+ ... ("static" sep ..String)
+ ... ("static" getsize [..String] "io" "try" ..Integer)
+ ... ("static" getmtime [..String] "io" "try" ..Float)]))}
(with_identifiers [g!temp]
(case import
(#Class [class format members])
@@ -334,11 +334,11 @@
)))
(template: .public (lambda <inputs> <output>)
- {#.doc (example "Allows defining closures/anonymous-functions in the form that Python expects."
- "This is useful for adapting Lux functions for usage by Python code."
- (: ..Function
- (lambda [left right]
- (do_something (:as Foo left) (:as Bar right)))))}
+ ... {#.doc (example "Allows defining closures/anonymous-functions in the form that Python expects."
+ ... "This is useful for adapting Lux functions for usage by Python code."
+ ... (: ..Function
+ ... (lambda [left right]
+ ... (do_something (:as Foo left) (:as Bar right)))))}
[(.:as ..Function
(`` ("python function"
(~~ (template.amount <inputs>))
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index 0a3efb41a..0862942c1 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -152,12 +152,12 @@
))
(syntax: .public (try [expression <code>.any])
- {#.doc (example (case (try (risky_computation input))
- (#.Right success)
- (do_something success)
+ ... {#.doc (example (case (try (risky_computation input))
+ ... (#.Right success)
+ ... (do_something success)
- (#.Left error)
- (recover_from_failure error)))}
+ ... (#.Left error)
+ ... (recover_from_failure error)))}
(in (list (` ("lux try" ((~! io.io) (~ expression)))))))
(def: (with_io with? without)
diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux
index 683926d3f..77b5ce94e 100644
--- a/stdlib/source/library/lux/macro/local.lux
+++ b/stdlib/source/library/lux/macro/local.lux
@@ -51,7 +51,7 @@
(-> [Name Macro] (Meta Any))
(do meta.monad
[[module_name definition_name] (meta.normal name)
- .let [definition (: Global (#.Definition [false .Macro (' {}) macro]))
+ .let [definition (: Global (#.Definition [false .Macro macro]))
add_macro! (: (-> (PList Global) (PList Global))
(plist.has definition_name definition))]]
(..with_module module_name
diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux
index 8d06987e0..a3562d51c 100644
--- a/stdlib/source/library/lux/macro/syntax.lux
+++ b/stdlib/source/library/lux/macro/syntax.lux
@@ -21,7 +21,9 @@
["[0]" rev]
["[0]" frac]]]]]
[//
- ["[0]" code]])
+ ["[0]" code]]
+ ["[0]" / "_"
+ ["[1][0]" export]])
(def: (self_documenting binding parser)
(All (_ a) (-> Code (Parser a) (Parser a)))
@@ -41,70 +43,54 @@
#.End #.End
(#.Item [[x y] pairs']) (list& x y (un_paired pairs'))))
-(macro: .public (syntax: tokens)
- (let [?parts (: (Maybe [Code Text (List Code) Code Code])
- (case tokens
- (^ (list export_policy
- [_ (#.Form (list [_ (#.Identifier ["" name])] [_ (#.Tuple args)]))]
- body))
- (#.Some [export_policy name args (` {}) body])
-
- (^ (list export_policy
- [_ (#.Form (list [_ (#.Identifier ["" name])] [_ (#.Tuple args)]))]
- meta_data
- body))
- (#.Some [export_policy name args meta_data body])
-
- (^ (list [_ (#.Form (list [_ (#.Identifier ["" name])] [_ (#.Tuple args)]))]
- body))
- (#.Some [(` .private) name args (` {}) body])
+(def: syntax
+ (Parser [Code [Text (List Code)] Code])
+ (/export.parser
+ ($_ <>.and
+ (</>.form ($_ <>.and
+ </>.local_identifier
+ (</>.tuple (<>.some </>.any))))
+ </>.any)))
- (^ (list [_ (#.Form (list [_ (#.Identifier ["" name])] [_ (#.Tuple args)]))]
- meta_data
- body))
- (#.Some [(` .private) name args meta_data body])
-
- _
- #.None))]
- (case ?parts
- (#.Some [export_policy name args meta body])
- (with_identifiers [g!tokens g!body g!error]
- (do [! meta.monad]
- [_ (if (|> args list.size nat.even?)
- (in [])
- (meta.failure "Syntax pattern expects pairs of bindings and code-parsers."))
- vars+parsers (monad.each !
- (: (-> [Code Code] (Meta [Code Code]))
- (function (_ [var parser])
- (with_expansions [<default> (in [var
- (` ((~! ..self_documenting) (' (~ var))
- (~ parser)))])]
- (case var
- [_ (#.Identifier ["" _])]
- <default>
+(macro: .public (syntax: tokens)
+ (case (</>.result ..syntax tokens)
+ (#try.Success [export_policy [name args] body])
+ (with_identifiers [g!tokens g!body g!error]
+ (do [! meta.monad]
+ [_ (if (|> args list.size nat.even?)
+ (in [])
+ (meta.failure "Syntax pattern expects pairs of bindings and code-parsers."))
+ vars+parsers (monad.each !
+ (: (-> [Code Code] (Meta [Code Code]))
+ (function (_ [var parser])
+ (with_expansions [<default> (in [var
+ (` ((~! ..self_documenting) (' (~ var))
+ (~ parser)))])]
+ (case var
+ [_ (#.Identifier ["" _])]
+ <default>
- [_ (#.Identifier _)]
- (in [var parser])
+ [_ (#.Identifier _)]
+ (in [var parser])
- _
- <default>))))
- (list.pairs args))
- this_module meta.current_module_name
- .let [g!state (code.identifier ["" "*lux*"])
- error_msg (code.text (macro.wrong_syntax_error [this_module name]))]]
- (in (list (` (macro: (~ export_policy) ((~ (code.identifier ["" name])) (~ g!tokens) (~ g!state))
- (~ meta)
- ({(#.Right (~ g!body))
- ((~ g!body) (~ g!state))
+ _
+ <default>))))
+ (list.pairs args))
+ this_module meta.current_module_name
+ .let [g!state (code.identifier ["" "*lux*"])
+ error_msg (code.text (macro.wrong_syntax_error [this_module name]))]]
+ (in (list (` (macro: (~ export_policy) ((~ (code.identifier ["" name])) (~ g!tokens) (~ g!state))
+ ({(#.Right (~ g!body))
+ ((~ g!body) (~ g!state))
- (#.Left (~ g!error))
- (#.Left ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error))))}
- ((~! </>.result)
- (: ((~! </>.Parser) (Meta (List Code)))
- ((~! do) (~! <>.monad)
- [(~+ (..un_paired vars+parsers))]
- ((~' in) (~ body))))
- (~ g!tokens)))))))))
-
- _
- (meta.failure (macro.wrong_syntax_error (name_of ..syntax:))))))
+ (#.Left (~ g!error))
+ (#.Left ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error))))}
+ ((~! </>.result)
+ (: ((~! </>.Parser) (Meta (List Code)))
+ ((~! do) (~! <>.monad)
+ [(~+ (..un_paired vars+parsers))]
+ ((~' in) (~ body))))
+ (~ g!tokens)))))))))
+
+ (#try.Failure error)
+ (meta.failure (macro.wrong_syntax_error (name_of ..syntax:)))))
diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux
index 164032dcb..91428bb7e 100644
--- a/stdlib/source/library/lux/macro/syntax/export.lux
+++ b/stdlib/source/library/lux/macro/syntax/export.lux
@@ -1,6 +1,8 @@
(.module:
[library
[lux "*"
+ [abstract
+ [monad {"+" [do]}]]
[control
["<>" parser ("[1]\[0]" monad)
["<[0]>" code {"+" [Parser]}]]]]])
@@ -9,7 +11,23 @@
Code
(` .private))
-(def: .public (parser un_exported)
+(def: policy
+ (Parser Code)
+ (do [! <>.monad]
+ [candiate <code>.next]
+ (case candiate
+ [_ (#.Identifier ["" _])]
+ (in default_policy)
+
+ (^or [_ (#.Bit _)]
+ [_ (#.Identifier _)])
+ (do !
+ [_ <code>.any]
+ (in candiate))
+
+ _
+ (in default_policy))))
+
+(def: .public parser
(All (_ a) (-> (Parser a) (Parser [Code a])))
- (<>.either (<>.and <code>.any un_exported)
- (<>.and (<>\in ..default_policy) un_exported)))
+ (<>.and ..policy))
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index bd36de002..122dde3ca 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -186,7 +186,7 @@
(#.Alias [r_module r_name])
(recur r_module r_name)
- (#.Definition [exported? def_type def_anns def_value])
+ (#.Definition [exported? def_type def_value])
(if (macro_type? def_type)
(#.Some (:as Macro def_value))
#.None)
@@ -365,14 +365,14 @@
[definition (..definition name)]
(case definition
(#.Definition definition)
- (let [[exported? def_type def_data def_value] definition]
+ (let [[exported? def_type def_value] definition]
(if exported?
(in definition)
(failure ($_ text\composite "Definition is not an export: " (name\encoded name)))))
(#.Type [exported? type labels])
(if exported?
- (in [exported? .Type (' {}) type])
+ (in [exported? .Type type])
(failure ($_ text\composite "Type is not an export: " (name\encoded name))))
(#.Alias de_aliased)
@@ -398,7 +398,7 @@
(#.Alias de_aliased)
(definition_type de_aliased)
- (#.Definition [exported? def_type def_data def_value])
+ (#.Definition [exported? def_type def_value])
(clean_type def_type)
(#.Type [exported? type labels])
@@ -432,7 +432,7 @@
(#.Alias de_aliased)
(type_definition de_aliased)
- (#.Definition [exported? def_type def_data def_value])
+ (#.Definition [exported? def_type def_value])
(let [type_code (`` ("lux in-module" (~~ (static .prelude_module)) .type_code))]
(if (or (same? .Type def_type)
(\ code.equivalence =
@@ -472,7 +472,7 @@
(#.Some [name definition])
(#.Type [exported? type labels])
- (#.Some [name [exported? .Type (' {}) type]])
+ (#.Some [name [exported? .Type type]])
(#.Label _)
#.None
@@ -486,9 +486,9 @@
(do ..monad
[constants (..definitions module_name)]
(in (do list.monad
- [[name [exported? def_type def_data def_value]] constants]
+ [[name [exported? def_type def_value]] constants]
(if exported?
- (in [name [exported? def_type def_data def_value]])
+ (in [name [exported? def_type def_value]])
(list))))))
(def: .public modules
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index 3f0233f62..c648d5bf2 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -249,8 +249,8 @@
)
(template [<name> <input> <format>]
- [(def: .public (<name> value)
- {#.doc "A 32-bit integer expression."}
+ [... A 32-bit integer expression.
+ (def: .public (<name> value)
(-> <input> Computation)
(:abstraction (..expression (format (<format> value) "|0"))))]
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index 4452644e7..9a9e1d473 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -60,7 +60,7 @@
(-> Text (List [Text Global]) (Stack Frame))
(!peek source reference
(case head
- (#.Definition [exported? frame_type frame_anns frame_value])
+ (#.Definition [exported? frame_type frame_value])
(:as (Stack Frame) frame_value)
(^or (#.Type _)
@@ -120,10 +120,9 @@
(-> Text Frame (List [Text Global]) (List [Text Global]))
(!push source reference
(case head
- (#.Definition [exported? frames_type frames_anns frames_value])
+ (#.Definition [exported? frames_type frames_value])
(#.Definition [exported?
frames_type
- frames_anns
(..push frame (:as (Stack Frame) frames_value))])
(^or (#.Type _)
@@ -149,10 +148,9 @@
(-> Text (List [Text Global]) (List [Text Global]))
(!push source reference
(case head
- (#.Definition [exported? frames_type frames_anns frames_value])
+ (#.Definition [exported? frames_type frames_value])
(#.Definition [exported?
frames_type
- frames_anns
(let [current_frames (:as (Stack Frame) frames_value)]
(case (..pop current_frames)
(#.Some current_frames')
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index 8949e5fe7..dc460e41d 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -22,8 +22,7 @@
[math
["[0]" number
["n" nat]]]
- ["[0]" meta
- ["[0]" annotation]]
+ ["[0]" meta]
["[0]" type ("[1]\[0]" equivalence)
["[0]" check {"+" [Check]}]]]])
@@ -136,7 +135,7 @@
(def: (available_definitions sig_type source_module target_module constants aggregate)
(-> Type Text Text (List [Text Definition]) (-> (List [Name Type]) (List [Name Type])))
- (list\mix (function (_ [name [exported? def_type def_anns def_value]] aggregate)
+ (list\mix (function (_ [name [exported? def_type def_value]] aggregate)
(if (and (or (text\= target_module source_module)
exported?)
(compatible_type? sig_type def_type))
diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux
index 155ac3bbb..494a9e62d 100644
--- a/stdlib/source/library/lux/type/unit.lux
+++ b/stdlib/source/library/lux/type/unit.lux
@@ -17,8 +17,7 @@
["[0]" code]
["[0]" template]
[syntax {"+" [syntax:]}
- ["|[0]|" export]
- ["|[0]|" annotations]]]
+ ["|[0]|" export]]]
[math
[number
["n" nat]
@@ -86,17 +85,15 @@
(-> Pure Int)
..out)
-(syntax: .public (unit: [[export_policy type_name unit_name annotations]
+(syntax: .public (unit: [[export_policy type_name unit_name]
(|export|.parser
($_ <>.and
<code>.local_identifier
- <code>.local_identifier
- (<>.else |annotations|.empty |annotations|.parser)))])
+ <code>.local_identifier))])
(do meta.monad
[@ meta.current_module_name
.let [g!type (code.local_identifier type_name)]]
(in (list (` (type: (~ export_policy) (~ g!type)
- (~ (|annotations|.format annotations))
(primitive (~ (code.text (%.name [@ type_name]))))))
(` (implementation: (~ export_policy) (~ (code.local_identifier unit_name))
@@ -117,19 +114,17 @@
(n.> 0 denominator))]
(in [numerator denominator]))))
-(syntax: .public (scale: [[export_policy type_name scale_name ratio annotations]
+(syntax: .public (scale: [[export_policy type_name scale_name ratio]
(|export|.parser
($_ <>.and
<code>.local_identifier
<code>.local_identifier
- ..scale
- (<>.else |annotations|.empty |annotations|.parser)))])
+ ..scale))])
(do meta.monad
[.let [(^slots [#ratio.numerator #ratio.denominator]) ratio]
@ meta.current_module_name
.let [g!scale (code.local_identifier type_name)]]
(in (list (` (type: (~ export_policy) ((~ g!scale) (~' u))
- (~ (|annotations|.format annotations))
(primitive (~ (code.text (%.name [@ type_name]))) [(~' u)])))
(` (implementation: (~ export_policy) (~ (code.local_identifier scale_name))
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index 3e2f87581..a4b94f517 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -100,9 +100,9 @@
(def: Base_Query (.type (Query No_Where No_Having No_Order No_Group No_Limit No_Offset)))
(def: Any_Query (.type (Query Any Any Any Any Any Any)))
+ ... Only use this function for debugging purposes.
+ ... Do not use this function to actually execute SQL code.
(def: .public read
- {#.doc (example "Only use this function for debugging purposes."
- "Do not use this function to actually execute SQL code.")}
(-> (SQL Any) Text)
(|>> :representation))
diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux
index e5b9baca5..5fed388e2 100644
--- a/stdlib/source/poly/lux/data/format/json.lux
+++ b/stdlib/source/poly/lux/data/format/json.lux
@@ -77,8 +77,8 @@
(def: decoded
(|>> (\ nat_codec decoded) (\ try.functor each .int))))
+... Builds a JSON generator for potentially inexistent values.
(def: (nullable writer)
- {#.doc "Builds a JSON generator for potentially inexistent values."}
(All (_ a) (-> (-> a JSON) (-> (Maybe a) JSON)))
(function (_ elem)
(case elem
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 745eeb005..694a10f7d 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -39,7 +39,7 @@
(template: (!global <definition>)
[(: [Text .Global]
- [(template.text [<definition>]) (#.Definition [true .Macro (' []) <definition>])])])
+ [(template.text [<definition>]) (#.Definition [true .Macro <definition>])])])
(syntax: (pow/2 [number <code>.any])
(in (list (` (nat.* (~ number) (~ number))))))
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index cea70ce68..ce832a8cf 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -361,7 +361,7 @@
(case def_type
(#.Some def_type)
(list [expected_short
- (#.Definition [exported? def_type (' []) expected_value])])
+ (#.Definition [exported? def_type expected_value])])
#.None
(list)))]
@@ -461,7 +461,6 @@
expected_type (\ ! each (function (_ name)
(#.Primitive name (list)))
(random.ascii/upper 1))
- .let [expected_annotations (' [])]
expected_value (random.either (in .def:)
(in .macro:))
.let [expected_lux
@@ -477,7 +476,7 @@
(case def_type
(#.Some def_type)
(list [expected_short
- (#.Definition [exported? def_type expected_annotations expected_value])])
+ (#.Definition [exported? def_type expected_value])])
#.None
(list)))]
@@ -575,10 +574,9 @@
definition!
(|> (/.definition [expected_macro_module expected_short])
(/.result expected_lux)
- (!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_annotations actual_value]))
+ (!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_value]))
(and (bit\= expected_exported? actual_exported?)
(same? expected_type actual_type)
- (same? expected_annotations actual_annotations)
(same? (:as Any expected_value) actual_value)))))
alias!
@@ -757,7 +755,7 @@
globals (: (List [Text .Global])
(list [name_4
- (#.Definition [false type_4 (' {}) []])]))
+ (#.Definition [false type_4 []])]))
scopes (list [#.name (list)
#.inner 0
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux
index 1d3960ab8..1db1336ea 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux
@@ -52,7 +52,7 @@
(-> Text [Bit Text] [Bit Text] Check Bit)
(|> (do [! phase.monad]
[_ (//module.with_module 0 def_module
- (//module.define var_name (#.Right [export? Any (' {}) []])))]
+ (//module.define var_name (#.Right [export? Any []])))]
(//module.with_module 0 dependent_module
(do !
[_ (if import?
@@ -88,7 +88,7 @@
(_.test "Can analyse definition (in the same module)."
(let [def_name [def_module var_name]]
(|> (do phase.monad
- [_ (//module.define var_name (#.Right [false expectedT (' {}) []]))]
+ [_ (//module.define var_name (#.Right [false expectedT []]))]
(//type.with_inference
(_primitive.phase archive.empty (code.identifier def_name))))
(//module.with_module 0 def_module)
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index 8d0015452..e8c4b0fba 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -158,7 +158,7 @@
(syntax: (with_error [exception <code>.identifier
to_expand <code>.any])
(monad.do meta.monad
- [[_ _ _ exception] (meta.export exception)]
+ [[_ _ exception] (meta.export exception)]
(function (_ compiler)
(#.Right [compiler
(list (code.bit (case ((macro.single_expansion to_expand) compiler)