aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/phase/generation
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation.lux58
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux6
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux1
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux1
4 files changed, 32 insertions, 34 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation.lux b/stdlib/source/lux/tool/compiler/phase/generation.lux
index 93dc97518..aa7d09d66 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation.lux
@@ -3,10 +3,10 @@
[abstract
[monad (#+ do)]]
[control
+ ["." try (#+ Try)]
["." exception (#+ exception:)]]
[data
["." product]
- ["." error (#+ Error)]
["." name ("#@." equivalence)]
["." text
["%" format (#+ format)]]
@@ -60,11 +60,11 @@
#inner-functions Nat})
(signature: #export (Host expression statement)
- (: (-> Text expression (Error Any))
+ (: (-> Text expression (Try Any))
evaluate!)
- (: (-> Text statement (Error Any))
+ (: (-> Text statement (Try Any))
execute!)
- (: (-> Name expression (Error [Text Any statement]))
+ (: (-> Name expression (Try [Text Any statement]))
define!))
(type: #export (Buffer statement) (Row [Name statement]))
@@ -111,12 +111,12 @@
(let [[old-scope old-inner] (get@ #context state)
new-scope (format old-scope "c" (%.nat old-inner))]
(case (expr [bundle (set@ #context [new-scope 0] state)])
- (#error.Success [[bundle' state'] output])
- (#error.Success [[bundle' (set@ #context [old-scope (inc old-inner)] state')]
- [new-scope output]])
+ (#try.Success [[bundle' state'] output])
+ (#try.Success [[bundle' (set@ #context [old-scope (inc old-inner)] state')]
+ [new-scope output]])
- (#error.Failure error)
- (#error.Failure error)))))
+ (#try.Failure error)
+ (#try.Failure error)))))
(def: #export context
(All [anchor expression statement]
@@ -136,12 +136,12 @@
(function (_ body)
(function (_ [bundle state])
(case (body [bundle (set@ <tag> (#.Some <with-value>) state)])
- (#error.Success [[bundle' state'] output])
- (#error.Success [[bundle' (set@ <tag> (get@ <tag> state) state')]
- output])
+ (#try.Success [[bundle' state'] output])
+ (#try.Success [[bundle' (set@ <tag> (get@ <tag> state) state')]
+ output])
- (#error.Failure error)
- (#error.Failure error)))))
+ (#try.Failure error)
+ (#try.Failure error)))))
(def: #export <get>
(All [anchor expression statement]
@@ -149,7 +149,7 @@
(function (_ (^@ stateE [bundle state]))
(case (get@ <tag> state)
(#.Some output)
- (#error.Success [stateE output])
+ (#try.Success [stateE output])
#.None
(exception.throw <exception> []))))
@@ -158,8 +158,8 @@
(All [anchor expression statement]
(-> <get-type> (Operation anchor expression statement Any)))
(function (_ [bundle state])
- (#error.Success [[bundle (set@ <tag> (#.Some value) state)]
- []])))]
+ (#try.Success [[bundle (set@ <tag> (#.Some value) state)]
+ []])))]
[#anchor
(with-anchor anchor)
@@ -200,10 +200,10 @@
(-> Text <inputT> (Operation anchor expression statement Any)))
(function (_ (^@ state+ [bundle state]))
(case (:: (get@ #host state) <name> label code)
- (#error.Success output)
- (#error.Success [state+ output])
+ (#try.Success output)
+ (#try.Success [state+ output])
- (#error.Failure error)
+ (#try.Failure error)
(exception.throw cannot-interpret error))))]
[evaluate! expression]
@@ -215,10 +215,10 @@
(-> Name expression (Operation anchor expression statement [Text Any statement])))
(function (_ (^@ stateE [bundle state]))
(case (:: (get@ #host state) define! name code)
- (#error.Success output)
- (#error.Success [stateE output])
+ (#try.Success output)
+ (#try.Success [stateE output])
- (#error.Failure error)
+ (#try.Failure error)
(exception.throw cannot-interpret error))))
(def: #export (save! execute? name code)
@@ -253,7 +253,7 @@
(let [cache (get@ #name-cache state)]
(case (dictionary.get lux-name cache)
(#.Some host-name)
- (#error.Success [stateE host-name])
+ (#try.Success [stateE host-name])
#.None
(exception.throw unknown-lux-name [lux-name cache])))))
@@ -265,11 +265,11 @@
(let [cache (get@ #name-cache state)]
(case (dictionary.get lux-name cache)
#.None
- (#error.Success [[bundle
- (update@ #name-cache
- (dictionary.put lux-name host-name)
- state)]
- []])
+ (#try.Success [[bundle
+ (update@ #name-cache
+ (dictionary.put lux-name host-name)
+ state)]
+ []])
(#.Some old-host-name)
(exception.throw cannot-overwrite-lux-name [lux-name old-host-name host-name])))))
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux
index f2d22f57b..9baf594da 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/common.lux
@@ -4,11 +4,11 @@
[abstract
["." monad (#+ do)]]
[control
+ ["." try]
["<>" parser
["<s>" synthesis (#+ Parser)]]]
[data
["." product]
- ["." error]
[collection
["." list ("#@." functor)]
["." dictionary]]]
@@ -33,10 +33,10 @@
Handler))
(function (_ extension-name phase input)
(case (<s>.run input parser)
- (#error.Success input')
+ (#try.Success input')
(handler extension-name phase input')
- (#error.Failure error)
+ (#try.Failure error)
(/////.throw extension.invalid-syntax [extension-name %synthesis input]))))
## [Procedures]
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux
index 423f0a58d..c44e1bdff 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/js/extension/host.lux
@@ -7,7 +7,6 @@
["<>" parser
["<s>" synthesis (#+ Parser)]]]
[data
- ["." error]
[collection
["." dictionary]]]
[target
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux
index 42c1d196d..e23692e88 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.lux
@@ -8,7 +8,6 @@
[parser
["s" code]]]
[data
- ["e" error]
["." product]
["." text]
[number (#+ hex)]