aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2023-01-17 01:14:08 -0400
committerEduardo Julian2023-01-17 01:14:08 -0400
commitdfe09eb7a90dbf164bc0c78085b2d340e0928190 (patch)
treea7591cf3c196d2586da8c2cf0493b937c2e9adad /stdlib/source/library/lux.lux
parent2351250b79656014eb441c39dc8c9a02cad1ee40 (diff)
Added compilation of (almost all non-loop) control structures for C++.
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r--stdlib/source/library/lux.lux156
1 files changed, 79 insertions, 77 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index bf922ec17..6046012c7 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -89,10 +89,10 @@
{2 #0 Text Text}})
#1)
-... (type .public (List a)
+... (type .public (List of)
... (Variant
... {#End}
-... {#Item a (List a)}))
+... {#Item of (List of)}))
(.def# List
(.is_type#
{9 #1
@@ -110,59 +110,22 @@
{4 #0 0}}}}}})
#1)
-... (type .public Tag
-... (Nominal "#Tag"))
-(.def# Tag
- (.is_type#
- {9 #1 [..prelude "Tag"]
- {0 #0 "#Tag" {0 #0}}})
- #1)
-
-... (type .public Slot
-... (Nominal "#Slot"))
-(.def# Slot
- (.is_type#
- {9 #1 [..prelude "Slot"]
- {0 #0 "#Slot" {0 #0}}})
- #1)
-
-(.def# Label'
- (.is_type#
- {1 #0 [Any {2 #0 [Nat {2 #0 [Bit {9 #0 Symbol List}]}]}]})
- #0)
-
-(.def# list_tags
- (.is# {9 #0 Symbol List}
- {0 #1 [[..prelude "#End"]
- {0 #1 [[..prelude "#Item"]
- {0 #0}]}]})
- #0)
-(.def# #End (.as# Tag [(.is# Label' {0 #1 [0 #0 ..list_tags]}) List]) #1)
-(.def# #Item (.as# Tag [(.is# Label' {0 #1 [0 #1 ..list_tags]}) List]) #1)
-
-... (type .public (Maybe a)
-... {#None}
-... {#Some a})
+... (type .public (Maybe of)
+... (Variant
+... {#None}
+... {#Some of}))
(.def# Maybe
(.is_type#
{9 #1
[..prelude "Maybe"]
{7 #0
- {#End}
+ {0 #0}
{1 #0
... None
Any
... Some
{4 #0 1}}}})
#1)
-(.def# maybe_tags
- (.is# {9 #0 Symbol List}
- {0 #1 [[..prelude "#None"]
- {0 #1 [[..prelude "#Some"]
- {0 #0}]}]})
- #0)
-(.def# #None (.as# Tag [(.is# Label' {0 #1 [0 #0 ..maybe_tags]}) Maybe]) #1)
-(.def# #Some (.as# Tag [(.is# Label' {0 #1 [0 #1 ..maybe_tags]}) Maybe]) #1)
... (type .public Type
... (Rec Type
@@ -185,9 +148,9 @@
({Type_List
({Type_Pair
{9 #0
- {0 #0 ["" {#End}]}
+ {0 #0 ["" {0 #0}]}
{7 #0
- {#End}
+ {0 #0}
{1 #0
... Nominal
{2 #0 Text Type_List}
@@ -222,9 +185,67 @@
{2 #0 Symbol Type}}}}}}}}}}}}}}
(.is_type# {2 #0 Type Type}))}
(.is_type# {9 #0 Type List}))}
- (.is_type# {9 #0 {0 #0 ["" {#End}]} {4 #0 0}}))})
+ (.is_type# {9 #0 {0 #0 ["" {0 #0}]} {4 #0 0}}))})
+ #1)
+
+... (type .public Label
+... [(Maybe [Nat Bit (List Symbol)])
+... Type])
+(.def# Label
+ (.is_type#
+ {9 #1 [..prelude "Label"]
+ {2 #0
+ {9 #0 {2 #0 Nat
+ {2 #0 Bit
+ {9 #0 Symbol List}}}
+ Maybe}
+ Type}})
+ #1)
+
+... (type .public Tag
+... (Nominal "#Tag"))
+(.def# Tag
+ (.is_type#
+ {9 #1 [..prelude "Tag"]
+ {0 #0 "#Tag" {0 #0}}})
+ #1)
+
+... (type .public Slot
+... (Nominal "#Slot"))
+(.def# Slot
+ (.is_type#
+ {9 #1 [..prelude "Slot"]
+ {0 #0 "#Slot" {0 #0}}})
#1)
+(.def# tag
+ (.is# {3 #0 Label Tag}
+ ([_ it] (.as# Tag it)))
+ #0)
+
+(.def# slot
+ (.is# {3 #0 Label Slot}
+ ([_ it] (.as# Slot it)))
+ #0)
+
+(.def# list_tags
+ (.is# {9 #0 Symbol List}
+ {0 #1 [[..prelude "#End"]
+ {0 #1 [[..prelude "#Item"]
+ {0 #0}]}]})
+ #0)
+(.def# #End (..tag [{0 #1 [0 #0 ..list_tags]} List]) #1)
+(.def# #Item (..tag [{0 #1 [0 #1 ..list_tags]} List]) #1)
+
+(.def# maybe_tags
+ (.is# {9 #0 Symbol List}
+ {0 #1 [[..prelude "#None"]
+ {0 #1 [[..prelude "#Some"]
+ {0 #0}]}]})
+ #0)
+(.def# #None (..tag [{0 #1 [0 #0 ..maybe_tags]} Maybe]) #1)
+(.def# #Some (..tag [{0 #1 [0 #1 ..maybe_tags]} Maybe]) #1)
+
(.def# type_tags
(.is# {9 #0 Symbol List}
{0 #1 [[..prelude "#Nominal"]
@@ -240,36 +261,17 @@
{0 #1 [[..prelude "#Named"]
{0 #0}]}]}]}]}]}]}]}]}]}]}]})
#0)
-(.def# #Nominal (.as# Tag [(.is# Label' {#Some [0 #0 ..type_tags]}) Type]) #1)
-(.def# #Sum (.as# Tag [(.is# Label' {#Some [1 #0 ..type_tags]}) Type]) #1)
-(.def# #Product (.as# Tag [(.is# Label' {#Some [2 #0 ..type_tags]}) Type]) #1)
-(.def# #Function (.as# Tag [(.is# Label' {#Some [3 #0 ..type_tags]}) Type]) #1)
-(.def# #Parameter (.as# Tag [(.is# Label' {#Some [4 #0 ..type_tags]}) Type]) #1)
-(.def# #Var (.as# Tag [(.is# Label' {#Some [5 #0 ..type_tags]}) Type]) #1)
-(.def# #Ex (.as# Tag [(.is# Label' {#Some [6 #0 ..type_tags]}) Type]) #1)
-(.def# #UnivQ (.as# Tag [(.is# Label' {#Some [7 #0 ..type_tags]}) Type]) #1)
-(.def# #ExQ (.as# Tag [(.is# Label' {#Some [8 #0 ..type_tags]}) Type]) #1)
-(.def# #Apply (.as# Tag [(.is# Label' {#Some [9 #0 ..type_tags]}) Type]) #1)
-(.def# #Named (.as# Tag [(.is# Label' {#Some [9 #1 ..type_tags]}) Type]) #1)
-
-... (type .public Label
-... [(Maybe [Nat Bit (List Symbol)]) Type])
-(.def# Label
- (.is# Type
- {#Named [..prelude "Label"]
- {#Product {#Apply {#Product Nat {#Product Bit {#Apply Symbol List}}} Maybe}
- Type}})
- #1)
-
-(.def# tag
- (.is# {#Function Label Tag}
- ([_ it] (.as# Tag it)))
- #0)
-
-(.def# slot
- (.is# {#Function Label Slot}
- ([_ it] (.as# Slot it)))
- #0)
+(.def# #Nominal (..tag [{#Some [0 #0 ..type_tags]} Type]) #1)
+(.def# #Sum (..tag [{#Some [1 #0 ..type_tags]} Type]) #1)
+(.def# #Product (..tag [{#Some [2 #0 ..type_tags]} Type]) #1)
+(.def# #Function (..tag [{#Some [3 #0 ..type_tags]} Type]) #1)
+(.def# #Parameter (..tag [{#Some [4 #0 ..type_tags]} Type]) #1)
+(.def# #Var (..tag [{#Some [5 #0 ..type_tags]} Type]) #1)
+(.def# #Ex (..tag [{#Some [6 #0 ..type_tags]} Type]) #1)
+(.def# #UnivQ (..tag [{#Some [7 #0 ..type_tags]} Type]) #1)
+(.def# #ExQ (..tag [{#Some [8 #0 ..type_tags]} Type]) #1)
+(.def# #Apply (..tag [{#Some [9 #0 ..type_tags]} Type]) #1)
+(.def# #Named (..tag [{#Some [9 #1 ..type_tags]} Type]) #1)
... (type .public Location
... (Record