aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library')
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux12
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux15
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux19
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/version.lux27
10 files changed, 74 insertions, 24 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
index 6b26d8cfb..7c70c99ed 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux
@@ -897,6 +897,9 @@
(^ (//////synthesis.branch/case [inputS pathS]))
(//////synthesis.branch/case [(again inputS) (normalize_path again pathS)])
+ (^ (//////synthesis.branch/exec [this that]))
+ (//////synthesis.branch/exec [(again this) (again that)])
+
(^ (//////synthesis.branch/let [inputS register outputS]))
(//////synthesis.branch/let [(again inputS) register (again outputS)])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
index 060a20f6d..83171eea1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux
@@ -47,6 +47,9 @@
(^ (synthesis.branch/case [valueS pathS]))
(/case.case generate archive [valueS pathS])
+ (^ (synthesis.branch/exec [this that]))
+ (/case.exec generate archive [this that])
+
(^ (synthesis.branch/let [inputS register bodyS]))
(/case.let generate archive [inputS register bodyS])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
index fd927cebd..c166c3aed 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" Type Label if let case int}
+ [lux {"-" Type Label if let exec case int}
[abstract
["[0]" monad {"+" do}]]
[control
@@ -276,6 +276,16 @@
(<| (_.when_acknowledged @end)
(_.set_label @end)))))))
+(def: .public (exec phase archive [this that])
+ (Generator [Synthesis Synthesis])
+ (do phase.monad
+ [this! (phase archive this)
+ that! (phase archive that)]
+ (in ($_ _.composite
+ this!
+ _.pop
+ that!))))
+
(def: .public (let phase archive [inputS register bodyS])
(Generator [Synthesis Register Synthesis])
(do phase.monad
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index 81551d45d..29d478d0b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -17,7 +17,7 @@
[number
["n" nat]
["[0]" i64]
- ["[0]" frac ("[1]#[0]" equivalence)]]]]]
+ ["[0]" frac]]]]]
["[0]" /// "_"
[//
["/" synthesis {"+" Path Synthesis Operation Phase}]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index 1f1c21778..e2380b282 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -173,6 +173,12 @@
(case control
{/.#Branch branch}
(case branch
+ {/.#Exec [this that]}
+ (do phase.monad
+ [this (grow environment this)
+ that (grow environment that)]
+ (in (/.branch/exec [this that])))
+
{/.#Let [inputS register bodyS]}
(do phase.monad
[inputS' (grow environment inputS)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
index 8c1ed71bb..8b9273084 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
@@ -120,6 +120,12 @@
path' (path_optimization (again return?) offset path)]
(in (|> path' [input'] /.branch/case)))
+ (^ (/.branch/exec [this that]))
+ (do maybe.monad
+ [this (again false this)
+ that (again return? that)]
+ (in (/.branch/exec [this that])))
+
(^ (/.branch/let [input register body]))
(do maybe.monad
[input' (again false input)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index 92f36b56b..375919eca 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -130,6 +130,10 @@
{/.#Control (case control
{/.#Branch branch}
{/.#Branch (case branch
+ {/.#Exec this that}
+ {/.#Exec (again this)
+ (again that)}
+
{/.#Let input register output}
{/.#Let (again input)
(..prune redundant register)
@@ -362,6 +366,13 @@
(case control
{/.#Branch branch}
(case branch
+ {/.#Exec this that}
+ (do try.monad
+ [[redundancy this] (optimization' [redundancy this])
+ [redundancy that] (optimization' [redundancy that])]
+ (in [redundancy
+ (/.branch/exec [this that])]))
+
{/.#Let input register output}
(do try.monad
[[redundancy input] (optimization' [redundancy input])
@@ -372,9 +383,7 @@
(maybe.else ..necessary!))]]
(in [(dictionary.lacks register redundancy)
{/.#Control (if redundant?
- {/.#Branch {/.#Case input
- {/.#Seq {/.#Pop}
- {/.#Then (..remove_local register output)}}}}
+ {/.#Branch {/.#Exec input (..remove_local register output)}}
{/.#Branch {/.#Let input register output}})}]))
{/.#If test then else}
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
index 002eddaec..c27fa9a81 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
@@ -99,6 +99,7 @@
(type: .public (Branch s)
(Variant
+ {#Exec s s}
{#Let s Register s}
{#If s s s}
{#Get (List Member) s}
@@ -261,6 +262,7 @@
content)])]
[branch/case ..#Branch ..#Case]
+ [branch/exec ..#Branch ..#Exec]
[branch/let ..#Branch ..#Let]
[branch/if ..#Branch ..#If]
[branch/get ..#Branch ..#Get]
@@ -383,6 +385,10 @@
{#Branch branch}
(case branch
+ {#Exec this that}
+ (|> (format (%synthesis this) " " (%synthesis that))
+ (text.enclosed ["{#exec " "}"]))
+
{#Let input register body}
(|> (format (%.nat register) " " (%synthesis input) " " (%synthesis body))
(text.enclosed ["{#let " "}"]))
@@ -626,25 +632,30 @@
(def: (hash value)
(case value
- {#Let [input register body]}
+ {#Exec this that}
($_ n.* 2
+ (# super hash this)
+ (# super hash that))
+
+ {#Let [input register body]}
+ ($_ n.* 3
(# super hash input)
(# n.hash hash register)
(# super hash body))
{#If [test then else]}
- ($_ n.* 3
+ ($_ n.* 5
(# super hash test)
(# super hash then)
(# super hash else))
{#Get [path record]}
- ($_ n.* 5
+ ($_ n.* 7
(# (list.hash ..member_hash) hash path)
(# super hash record))
{#Case [input path]}
- ($_ n.* 7
+ ($_ n.* 11
(# super hash input)
(# (..path'_hash super) hash path))
)))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux
index 5961a373f..f3e1c6d83 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux
@@ -101,6 +101,11 @@
(case value
{synthesis.#Branch value}
(case value
+ {synthesis.#Exec this that}
+ ($_ list#composite
+ (references this)
+ (references that))
+
{synthesis.#Let input _ body}
($_ list#composite
(references input)
diff --git a/stdlib/source/library/lux/tool/compiler/version.lux b/stdlib/source/library/lux/tool/compiler/version.lux
index 3a923011d..c87b3a270 100644
--- a/stdlib/source/library/lux/tool/compiler/version.lux
+++ b/stdlib/source/library/lux/tool/compiler/version.lux
@@ -1,31 +1,28 @@
(.using
- [library
- [lux "*"
- [data
- [text
- ["%" format]]]
- [math
- [number
- ["n" nat]]]]])
+ [library
+ [lux "*"
+ [data
+ [text
+ ["%" format]]]
+ [math
+ [number
+ ["n" nat]]]]])
(type: .public Version
Nat)
-(def: range 100)
+(def: range
+ 100)
(def: level
(n.% ..range))
-(def: current
- (-> Nat Nat)
- (|>>))
-
(def: next
(n./ ..range))
(def: .public patch
(-> Version Nat)
- (|>> ..current ..level))
+ (|>> ..level))
(def: .public minor
(-> Version Nat)
@@ -45,7 +42,7 @@
(def: .public (format version)
(%.Format Version)
- (%.format (..padded (..major version))
+ (%.format (%.nat (..major version))
..separator
(..padded (..minor version))
..separator