aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/scheme
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme.lux36
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux40
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux2
3 files changed, 39 insertions, 39 deletions
diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux
index a117899fa..af3208414 100644
--- a/new-luxc/source/luxc/lang/translation/scheme.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme.lux
@@ -72,7 +72,7 @@
#interpreter (function (_ code)
(do e.Monad<Error>
[output (Language::eval [(scheme.expression code)] interpreter)]
- (wrap (maybe.default (:! Object [])
+ (wrap (maybe.default (:coerce Object [])
output))))
#module-buffer #.None
#program-buffer (StringBuilder::new [])})))
@@ -85,26 +85,26 @@
(Meta Any)
(function (_ compiler)
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #module-buffer (#.Some (StringBuilder::new [])))
- (:! Nothing))
+ (:coerce Nothing))
compiler)
[]])))
(def: #export (with-sub-context expr)
(All [a] (-> (Meta a) (Meta [Text a])))
(function (_ compiler)
- (let [old (:! Host (get@ #.host compiler))
+ (let [old (:coerce Host (get@ #.host compiler))
[old-name old-sub] (get@ #context old)
new-name (format old-name "f___" (%i (.int old-sub)))]
(case (expr (set@ #.host
- (:! Nothing (set@ #context [new-name +0] old))
+ (:coerce Nothing (set@ #context [new-name +0] old))
compiler))
(#e.Success [compiler' output])
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #context [old-name (inc old-sub)])
- (:! Nothing))
+ (:coerce Nothing))
compiler')
[new-name output]])
@@ -116,7 +116,7 @@
(function (_ compiler)
(#e.Success [compiler
(|> (get@ #.host compiler)
- (:! Host)
+ (:coerce Host)
(get@ #context)
(let> [name sub]
name))])))
@@ -124,15 +124,15 @@
(def: #export (with-anchor anchor expr)
(All [a] (-> Anchor (Meta a) (Meta a)))
(function (_ compiler)
- (let [old (:! Host (get@ #.host compiler))]
+ (let [old (:coerce Host (get@ #.host compiler))]
(case (expr (set@ #.host
- (:! Nothing (set@ #anchor (#.Some anchor) old))
+ (:coerce Nothing (set@ #anchor (#.Some anchor) old))
compiler))
(#e.Success [compiler' output])
(#e.Success [(update@ #.host
- (|>> (:! Host)
+ (|>> (:coerce Host)
(set@ #anchor (get@ #anchor old))
- (:! Nothing))
+ (:coerce Nothing))
compiler')
output])
@@ -142,7 +142,7 @@
(def: #export anchor
(Meta Anchor)
(function (_ compiler)
- (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor))
+ (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor))
(#.Some anchor)
(#e.Success [compiler anchor])
@@ -152,7 +152,7 @@
(def: #export module-buffer
(Meta StringBuilder)
(function (_ compiler)
- (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer))
+ (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer))
#.None
((lang.throw No-Active-Module-Buffer "") compiler)
@@ -162,13 +162,13 @@
(def: #export program-buffer
(Meta StringBuilder)
(function (_ compiler)
- (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))])))
+ (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))])))
(do-template [<name> <field> <outputT>]
[(def: (<name> code)
(-> Expression (Meta <outputT>))
(function (_ compiler)
- (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))]
+ (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))]
(case (runner code)
(#e.Error error)
((lang.throw Cannot-Execute error) compiler)
@@ -192,7 +192,7 @@
(-> Expression (Meta Any))
(do macro.Monad<Meta>
[module-buffer module-buffer
- #let [_ (Appendable::append [(:! CharSequence (scheme.expression code))]
+ #let [_ (Appendable::append [(:coerce CharSequence (scheme.expression code))]
module-buffer)]]
(load! code)))
@@ -205,7 +205,7 @@
module-buffer module-buffer
program-buffer program-buffer
#let [module-code (StringBuilder::toString [] module-buffer)
- _ (Appendable::append [(:! CharSequence (format module-code "\n"))]
+ _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))]
program-buffer)]]
(wrap (ioC.write target
(format (lang.normalize-name module) "/" r-module-name)
diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux
index 362deee4a..72c58587c 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux
@@ -60,21 +60,21 @@
(def: (parse-tuple lux-object host-object)
(-> (-> Object (Error Any)) (FVector Object) (Error Any))
- (let [size (:! Nat (FVector::getBufferLength [] host-object))]
+ (let [size (:coerce Nat (FVector::getBufferLength [] host-object))]
(loop [idx +0
- output (:! (Array Any) (array.new size))]
+ output (:coerce (Array Any) (array.new size))]
(if (n/< size idx)
- (case (lux-object (FVector::get [(:! Int idx)] host-object))
+ (case (lux-object (FVector::get [(:coerce Int idx)] host-object))
(#e.Error error)
(#e.Error error)
(#e.Success lux-value)
- (recur (inc idx) (array.write idx (:! Any lux-value) output)))
+ (recur (inc idx) (array.write idx (:coerce Any lux-value) output)))
(#e.Success output)))))
(def: (variant tag flag value)
(-> Nat Bool Any Any)
- [(Long::intValue [] (:! Long tag))
+ [(Long::intValue [] (:coerce Long tag))
(: Any
(if flag
//.unit
@@ -83,24 +83,24 @@
(def: (to-text value)
(-> Any Text)
- (let [value-text (:! Text (Object::toString [] (:! Object value)))
- class-text (:! Text (Object::toString [] (Object::getClass [] (:! Object value))))]
+ (let [value-text (:coerce Text (Object::toString [] (:coerce Object value)))
+ class-text (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object value))))]
(format value-text " : " class-text)))
(def: (parse-variant lux-object host-object)
(-> (-> Object (Error Any)) Pair (Error Any))
(let [variant-tag (Pair::getCar [] host-object)]
(if (and (host.instance? gnu/mapping/SimpleSymbol variant-tag)
- (text/= //.variant-tag (Symbol::getName [] (:! Symbol variant-tag))))
+ (text/= //.variant-tag (Symbol::getName [] (:coerce Symbol variant-tag))))
(do e.Monad<Error>
- [#let [host-object (:! Pair (Pair::getCdr [] host-object))]
+ [#let [host-object (:coerce Pair (Pair::getCdr [] host-object))]
tag (lux-object (Pair::getCar [] host-object))
- #let [host-object (:! Pair (Pair::getCdr [] host-object))]
+ #let [host-object (:coerce Pair (Pair::getCdr [] host-object))]
#let [flag (host.instance? java/lang/String
(Pair::getCar [] host-object))]
value (lux-object (Pair::getCdr [] host-object))]
- (wrap (..variant (:! Nat tag) flag value)))
- (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object)))))))
+ (wrap (..variant (:coerce Nat tag) flag value)))
+ (ex.throw invalid-variant (:coerce Text (Object::toString [] (:coerce Object host-object)))))))
(def: (lux-object host-object)
(-> Object (Error Any))
@@ -109,32 +109,32 @@
(#e.Success host-object)
(host.instance? gnu/math/IntNum host-object)
- (#e.Success (IntNum::longValue [] (:! IntNum host-object)))
+ (#e.Success (IntNum::longValue [] (:coerce IntNum host-object)))
(host.instance? gnu/math/DFloNum host-object)
- (#e.Success (DFloNum::doubleValue [] (:! DFloNum host-object)))
+ (#e.Success (DFloNum::doubleValue [] (:coerce DFloNum host-object)))
(host.instance? gnu/lists/FString host-object)
- (#e.Success (FString::toString [] (:! FString host-object)))
+ (#e.Success (FString::toString [] (:coerce FString host-object)))
(host.instance? gnu/lists/FVector host-object)
- (parse-tuple lux-object (:! (FVector Object) host-object))
+ (parse-tuple lux-object (:coerce (FVector Object) host-object))
(host.instance? gnu/lists/EmptyList host-object)
(#e.Success //.unit)
(host.instance? gnu/lists/Pair host-object)
- (parse-variant lux-object (:! Pair host-object))
+ (parse-variant lux-object (:coerce Pair host-object))
## else
- (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object))))
- text-representation (:! Text (Object::toString [] (:! Object host-object)))]
+ (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object))))
+ text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))]
(ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation)))))
(def: #export (eval code)
(-> Expression (Meta Any))
(function (_ compiler)
- (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))]
+ (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))]
(case (interpreter code)
(#e.Error error)
(exec (log! (format "eval #e.Error\n"
diff --git a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux
index 43e18cb85..aa1411c18 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux
@@ -34,7 +34,7 @@
(wrap [])
tags
- (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV)))
+ (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV)))
(wrap []))
#let [_ (log! (format "DEF " (%ident def-ident)))]]
(wrap []))