aboutsummaryrefslogtreecommitdiff
path: root/new-luxc
diff options
context:
space:
mode:
authorEduardo Julian2017-11-01 13:36:15 -0400
committerEduardo Julian2017-11-01 13:36:15 -0400
commit88006e957373bbd72ec68897474303964885fc68 (patch)
treea34f88ea0921f56737c8881345245e11e7c8b546 /new-luxc
parent012f6bd41e527479dddbccbdab10daa78fd9a0fd (diff)
- Minor refactorings.
- Fixed some bugs. - Enabled macro-expansion for statements.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/eval.lux2
-rw-r--r--new-luxc/source/luxc/host/macro.lux37
-rw-r--r--new-luxc/source/luxc/lang/analysis/case.lux2
-rw-r--r--new-luxc/source/luxc/lang/analysis/expression.lux32
-rw-r--r--new-luxc/source/luxc/lang/synthesis/case.lux17
-rw-r--r--new-luxc/source/luxc/lang/synthesis/expression.lux58
-rw-r--r--new-luxc/source/luxc/lang/translation.lux60
-rw-r--r--new-luxc/source/luxc/lang/translation/case.jvm.lux32
-rw-r--r--new-luxc/source/luxc/lang/translation/expression.jvm.lux38
-rw-r--r--new-luxc/source/luxc/lang/translation/function.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/primitive.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/procedure.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux6
-rw-r--r--new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux66
-rw-r--r--new-luxc/source/luxc/lang/translation/reference.jvm.lux6
-rw-r--r--new-luxc/source/luxc/lang/translation/runtime.jvm.lux16
-rw-r--r--new-luxc/source/luxc/lang/translation/statement.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/structure.jvm.lux10
-rw-r--r--new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux2
-rw-r--r--new-luxc/test/test/luxc/lang/analysis/type.lux4
-rw-r--r--new-luxc/test/test/luxc/lang/translation/case.lux28
-rw-r--r--new-luxc/test/test/luxc/lang/translation/function.lux16
-rw-r--r--new-luxc/test/test/luxc/lang/translation/primitive.lux8
-rw-r--r--new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux56
-rw-r--r--new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux112
-rw-r--r--new-luxc/test/test/luxc/lang/translation/reference.lux12
-rw-r--r--new-luxc/test/test/luxc/lang/translation/structure.lux10
27 files changed, 346 insertions, 320 deletions
diff --git a/new-luxc/source/luxc/eval.lux b/new-luxc/source/luxc/eval.lux
index 82c355151..6431b59d6 100644
--- a/new-luxc/source/luxc/eval.lux
+++ b/new-luxc/source/luxc/eval.lux
@@ -14,5 +14,5 @@
[exprA (../base;with-expected-type type
(expressionA;analyser eval exprC))
#let [exprS (expressionS;synthesize exprA)]
- exprI (expressionT;generate exprS)]
+ exprI (expressionT;translate exprS)]
(evalT;eval exprI)))
diff --git a/new-luxc/source/luxc/host/macro.lux b/new-luxc/source/luxc/host/macro.lux
new file mode 100644
index 000000000..1a3152222
--- /dev/null
+++ b/new-luxc/source/luxc/host/macro.lux
@@ -0,0 +1,37 @@
+(;module:
+ lux
+ (lux (control [monad #+ do])
+ (data ["e" error])
+ [meta]
+ [host])
+ (luxc [";L" host]
+ (lang (translation [";T" common]))))
+
+(for {"JVM" (as-is (host;import java.lang.reflect.Method
+ (invoke [Object (Array Object)] #try Object))
+ (host;import (java.lang.Class c)
+ (getMethod [String (Array (Class Object))] #try Method))
+ (host;import java.lang.Object
+ (getClass [] (Class Object))
+ (toString [] String))
+ (def: _object-class (Class Object) (host;class-for Object))
+ (def: _apply-args
+ (Array (Class Object))
+ (|> (host;array (Class Object) +2)
+ (host;array-write +0 _object-class)
+ (host;array-write +1 _object-class)))
+ (def: #export (expand macro inputs)
+ (-> Macro (List Code) (Meta (List Code)))
+ (do meta;Monad<Meta>
+ [class (commonT;load-class hostL;function-class)]
+ (function [compiler]
+ (do e;Monad<Error>
+ [apply-method (Class.getMethod ["apply" _apply-args] class)
+ output (Method.invoke [(:! Object macro)
+ (|> (host;array Object +2)
+ (host;array-write +0 (:! Object inputs))
+ (host;array-write +1 (:! Object compiler)))]
+ apply-method)]
+ (:! (e;Error [Compiler (List Code)])
+ output))))))
+ })
diff --git a/new-luxc/source/luxc/lang/analysis/case.lux b/new-luxc/source/luxc/lang/analysis/case.lux
index 1e40e38f1..f68733d7f 100644
--- a/new-luxc/source/luxc/lang/analysis/case.lux
+++ b/new-luxc/source/luxc/lang/analysis/case.lux
@@ -165,7 +165,7 @@
(do @
[nextA next]
(wrap [(list) nextA]))
- matches)]
+ (list;reverse matches))]
(wrap [(` ("lux case tuple" [(~@ memberP+)]))
thenA])))
diff --git a/new-luxc/source/luxc/lang/analysis/expression.lux b/new-luxc/source/luxc/lang/analysis/expression.lux
index de0e49dbc..12256a4bf 100644
--- a/new-luxc/source/luxc/lang/analysis/expression.lux
+++ b/new-luxc/source/luxc/lang/analysis/expression.lux
@@ -11,6 +11,7 @@
[host])
(luxc ["&" base]
[";L" host]
+ (host [";H" macro])
(lang ["la" analysis]
(translation [";T" common]))
["&;" module])
@@ -21,35 +22,6 @@
[";A" structure]
[";A" procedure]))
-(for {"JVM" (as-is (host;import java.lang.reflect.Method
- (invoke [Object (Array Object)] #try Object))
- (host;import (java.lang.Class c)
- (getMethod [String (Array (Class Object))] #try Method))
- (host;import java.lang.Object
- (getClass [] (Class Object))
- (toString [] String))
- (def: _object-class (Class Object) (host;class-for Object))
- (def: _apply-args
- (Array (Class Object))
- (|> (host;array (Class Object) +2)
- (host;array-write +0 _object-class)
- (host;array-write +1 _object-class)))
- (def: (call-macro macro inputs)
- (-> Macro (List Code) (Meta (List Code)))
- (do meta;Monad<Meta>
- [class (commonT;load-class hostL;function-class)]
- (function [compiler]
- (do e;Monad<Error>
- [apply-method (Class.getMethod ["apply" _apply-args] class)
- output (Method.invoke [(:! Object macro)
- (|> (host;array Object +2)
- (host;array-write +0 (:! Object inputs))
- (host;array-write +1 (:! Object compiler)))]
- apply-method)]
- (:! (e;Error [Compiler (List Code)])
- output))))))
- })
-
(exception: #export Macro-Expression-Must-Have-Single-Expansion)
(exception: #export Unrecognized-Syntax)
@@ -119,7 +91,7 @@
(if (meta;macro? def-anns)
(do @
[expansion (function [compiler]
- (case (call-macro (:! Macro def-value) args compiler)
+ (case (macroH;expand (:! Macro def-value) args compiler)
(#e;Success [compiler' output])
(#e;Success [compiler' output])
diff --git a/new-luxc/source/luxc/lang/synthesis/case.lux b/new-luxc/source/luxc/lang/synthesis/case.lux
index 15cb6eca3..e66bbf3a8 100644
--- a/new-luxc/source/luxc/lang/synthesis/case.lux
+++ b/new-luxc/source/luxc/lang/synthesis/case.lux
@@ -2,6 +2,7 @@
lux
(lux (data [bool "bool/" Eq<Bool>]
[text "text/" Eq<Text>]
+ text/format
[number]
(coll [list "list/" Fold<List>]))
(meta [code "code/" Eq<Code>]))
@@ -11,7 +12,7 @@
(def: #export (path pattern)
(-> la;Pattern ls;Path)
(case pattern
- (^code [(~@ membersP)])
+ (^code ("lux case tuple" [(~@ membersP)]))
(case (list;reverse membersP)
#;Nil
(' ("lux case pop"))
@@ -30,12 +31,16 @@
[(n.dec last-idx)
(` ("lux case tuple right" (~ (code;nat last-idx)) (~ (path lastP))))]
prevsP)]
- tuple-path))
+ (` ("lux case seq"
+ (~ tuple-path)
+ ("lux case pop")))))
- (^code ((~ [_ (#;Nat tag)]) (~ [_ (#;Nat num-tags)]) (~ memberP)))
- (if (n.= (n.dec num-tags) tag)
- (` ("lux case variant right" (~ (code;nat tag)) (~ (path memberP))))
- (` ("lux case variant left" (~ (code;nat tag)) (~ (path memberP)))))
+ (^code ("lux case variant" (~ [_ (#;Nat tag)]) (~ [_ (#;Nat num-tags)]) (~ memberP)))
+ (` ("lux case seq"
+ (~ (if (n.= (n.dec num-tags) tag)
+ (` ("lux case variant right" (~ (code;nat tag)) (~ (path memberP))))
+ (` ("lux case variant left" (~ (code;nat tag)) (~ (path memberP))))))
+ ("lux case pop")))
_
pattern))
diff --git a/new-luxc/source/luxc/lang/synthesis/expression.lux b/new-luxc/source/luxc/lang/synthesis/expression.lux
index 05b99923b..531606ba7 100644
--- a/new-luxc/source/luxc/lang/synthesis/expression.lux
+++ b/new-luxc/source/luxc/lang/synthesis/expression.lux
@@ -85,11 +85,11 @@
(|> (synthesize expr)
(~) ("lux case exec")
("lux case seq" (~ (caseS;path pattern)))
- (`))))]
- (` ("lux case" (~ inputS)
- (~ (list/fold caseS;weave
- (transform-branch lastP lastA)
- (list/map (product;uncurry transform-branch) prevsPA))))))
+ (`))))
+ pathS (list/fold caseS;weave
+ (transform-branch lastP lastA)
+ (list/map (product;uncurry transform-branch) prevsPA))]
+ (` ("lux case" (~ inputS) (~ pathS))))
_
(undefined)
@@ -117,46 +117,42 @@
_
(call$ funcS argsS))))
-(def: #export (synthesize analysis)
+(def: #export (synthesize expressionA)
(-> la;Analysis ls;Synthesis)
(loop [outer-arity +0
resolver init-resolver
num-locals +0
- exprA analysis]
- (case exprA
+ expressionA expressionA]
+ (case expressionA
(^code [(~ _left) (~ _right)])
- (` [(~@ (list/map (recur +0 resolver num-locals) (la;unfold-tuple exprA)))])
+ (` [(~@ (list/map (recur outer-arity resolver num-locals) (la;unfold-tuple expressionA)))])
(^or (^code ("lux sum left" (~ _)))
(^code ("lux sum right" (~ _))))
- (let [[tag last? value] (maybe;assume (la;unfold-variant exprA))]
- (variant$ tag last? (recur +0 resolver num-locals value)))
+ (let [[tag last? value] (maybe;assume (la;unfold-variant expressionA))]
+ (variant$ tag last? (recur outer-arity resolver num-locals value)))
(^code ((~ [_ (#;Int var)])))
(if (variableL;local? var)
- (let [register (variableL;local-register var)]
- (if (functionS;nested? outer-arity)
- (if (n.= +0 register)
- (call$ (var$ 0) (|> (list;n.range +1 (n.dec outer-arity))
- (list/map (|>. variableL;local code;int (~) () (`)))))
- (var$ (functionS;adjust-var outer-arity (variableL;local register))))
- (var$ (variableL;local register))))
- (let [register (variableL;captured-register var)]
- (var$ (let [var (variableL;captured register)]
- (maybe;default var (dict;get var resolver))))))
+ (if (functionS;nested? outer-arity)
+ (if (variableL;self? var)
+ (call$ (var$ 0) (|> (list;n.range +1 (n.dec outer-arity))
+ (list/map (|>. variableL;local code;int (~) () (`)))))
+ (var$ (functionS;adjust-var outer-arity var)))
+ (var$ var))
+ (var$ (maybe;default var (dict;get var resolver))))
(^code ("lux case" (~ inputA) (~ [_ (#;Record branchesA)])))
- (synthesize-case (recur +0 resolver num-locals) inputA branchesA)
+ (synthesize-case (recur outer-arity resolver num-locals) inputA branchesA)
(^multi (^code ("lux function" [(~@ scope)] (~ bodyA)))
[(s;run scope (p;some s;int)) (#e;Success raw-env)])
(let [inner-arity (n.inc outer-arity)
env (list/map (function [var] (maybe;default var (dict;get var resolver))) raw-env)
- env-vars (let [env-size (list;size raw-env)]
- (: (List Variable)
- (case env-size
- +0 (list)
- _ (list/map variableL;captured (list;n.range +0 (n.dec env-size))))))
+ env-vars (: (List Variable)
+ (case raw-env
+ #;Nil (list)
+ _ (|> (list;size raw-env) n.dec (list;n.range +0) (list/map variableL;captured))))
resolver' (if (functionS;nested? inner-arity)
(list/fold (function [[from to] resolver']
(dict;put from to resolver'))
@@ -166,7 +162,7 @@
(dict;put var var resolver'))
init-resolver
env-vars))]
- (case (recur inner-arity resolver' +0 bodyA)
+ (case (recur inner-arity resolver' num-locals bodyA)
(^ [_ (#;Form (list [_ (#;Text "lux function")] [_ (#;Nat arity')] env' bodyS'))])
(let [arity (n.inc arity')]
(function$ arity env (prepare-body inner-arity arity bodyS')))
@@ -175,10 +171,10 @@
(function$ +1 env (prepare-body inner-arity +1 bodyS))))
(^code ("lux apply" (~@ _)))
- (synthesize-apply synthesize outer-arity num-locals exprA)
+ (synthesize-apply (recur outer-arity resolver num-locals) outer-arity num-locals expressionA)
(^code ((~ [_ (#;Text name)]) (~@ args)))
- (procedure$ name (list/map (recur +0 resolver num-locals) args))
+ (procedure$ name (list/map (recur outer-arity resolver num-locals) args))
_
- exprA)))
+ expressionA)))
diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux
index 4fcc3ccb2..60fbde6c8 100644
--- a/new-luxc/source/luxc/lang/translation.lux
+++ b/new-luxc/source/luxc/lang/translation.lux
@@ -1,6 +1,7 @@
(;module:
lux
- (lux (control [monad #+ do])
+ (lux (control [monad #+ do]
+ ["ex" exception #+ exception:])
(concurrency ["T" task])
(data ["e" error]
[text "text/" Hash<Text>]
@@ -12,6 +13,7 @@
(world [file #+ File]))
(luxc ["&" base]
[";L" host]
+ (host [";H" macro])
["&;" io]
["&;" module]
["&;" eval]
@@ -30,18 +32,17 @@
(&;Analyser)
(expressionA;analyser &eval;eval))
-(def: (generate code)
+(exception: #export Unrecognized-Statement)
+
+(def: (translate code)
(-> Code (Meta Unit))
(case code
- (^ [_ (#;Form (list [_ (#;Text "lux def")]
- [_ (#;Symbol ["" def-name])]
- valueC
- metaC))])
+ (^code ("lux def" (~ [_ (#;Symbol ["" def-name])]) (~ valueC) (~ metaC)))
(do meta;Monad<Meta>
[[_ metaA] (&;with-scope
(&;with-expected-type Code
(analyse metaC)))
- metaI (expressionT;generate (expressionS;synthesize metaA))
+ metaI (expressionT;translate (expressionS;synthesize metaA))
metaV (evalT;eval metaI)
[_ valueT valueA] (&;with-scope
(if (meta;type? (:! Code metaV))
@@ -51,23 +52,38 @@
(wrap [Type valueA])))
(commonA;with-unknown-type
(analyse valueC))))
- valueI (expressionT;generate (expressionS;synthesize valueA))
+ valueI (expressionT;translate (expressionS;synthesize valueA))
_ (&;with-scope
- (statementT;generate-def def-name valueT valueI metaI (:! Code metaV)))]
+ (statementT;translate-def def-name valueT valueI metaI (:! Code metaV)))]
(wrap []))
- (^ [_ (#;Form (list [_ (#;Text "lux program")]
- [_ (#;Symbol ["" program-args])]
- programC))])
+ (^code ("lux program" (~ [_ (#;Symbol ["" program-args])]) (~ programC)))
(do meta;Monad<Meta>
[[_ programA] (&;with-scope
(&;with-expected-type (type (io;IO Unit))
(analyse programC)))
- programI (expressionT;generate (expressionS;synthesize programA))]
- (statementT;generate-program program-args programI))
+ programI (expressionT;translate (expressionS;synthesize programA))]
+ (statementT;translate-program program-args programI))
+
+ (^code ((~ [_ (#;Symbol macro-name)]) (~@ args)))
+ (do meta;Monad<Meta>
+ [macro-name (meta;normalize macro-name)
+ [def-type def-anns def-value] (meta;find-def macro-name)]
+ (if (meta;macro? def-anns)
+ (do @
+ [expansion (function [compiler]
+ (case (macroH;expand (:! Macro def-value) args compiler)
+ (#e;Success [compiler' output])
+ (#e;Success [compiler' output])
+
+ (#e;Error error)
+ ((&;fail error) compiler)))
+ _ (monad;map @ translate expansion)]
+ (wrap []))
+ (&;throw Unrecognized-Statement (%code code))))
_
- (&;fail (format "Unrecognized statement: " (%code code)))))
+ (&;throw Unrecognized-Statement (%code code))))
(def: (exhaust action)
(All [a] (-> (Meta a) (Meta Unit)))
@@ -97,7 +113,7 @@
(#e;Success [(set@ #;source source' compiler)
output]))))
-(def: (generate-module source-dirs module-name target-dir compiler)
+(def: (translate-module source-dirs module-name target-dir compiler)
(-> (List File) Text File Compiler (T;Task Compiler))
(do T;Monad<Task>
[_ (&io;prepare-module target-dir module-name)
@@ -115,9 +131,9 @@
[code parse
#let [[cursor _] code]]
(&;with-cursor cursor
- (generate code)))))))]
+ (translate code)))))))]
(wrap artifacts)
- ## (&module;generate-descriptor module-name)
+ ## (&module;translate-descriptor module-name)
))
(#e;Success [compiler artifacts ## module-descriptor
])
@@ -159,10 +175,10 @@
#;scope-type-vars (list)
#;host (:! Void host)})
-(def: #export (generate-program program target sources)
+(def: #export (translate-program program target sources)
(-> Text File (List File) (T;Task Unit))
(do T;Monad<Task>
- [compiler (|> (case (runtimeT;generate (init-compiler (io;run hostL;init-host)))
+ [compiler (|> (case (runtimeT;translate (init-compiler (io;run hostL;init-host)))
(#e;Error error)
(T;fail error)
@@ -173,7 +189,7 @@
_ (&io;write-file target hostL;function-class function-bc)]
(wrap compiler)))
(: (T;Task Compiler))
- (:: @ map (generate-module sources prelude target)) (:: @ join)
- (:: @ map (generate-module sources program target)) (:: @ join))
+ (:: @ map (translate-module sources prelude target)) (:: @ join)
+ (:: @ map (translate-module sources program target)) (:: @ join))
#let [_ (log! "Compilation complete!")]]
(wrap [])))
diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux
index a9ea4482a..3858627ff 100644
--- a/new-luxc/source/luxc/lang/translation/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux
@@ -54,13 +54,13 @@
(exception: #export Unrecognized-Path)
-(def: (generate-path' generate stack-depth @else @end path)
+(def: (translate-path' translate stack-depth @else @end path)
(-> (-> ls;Synthesis (Meta $;Inst))
Nat $;Label $;Label ls;Path (Meta $;Inst))
(case path
(^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))])
(do meta;Monad<Meta>
- [bodyI (generate bodyS)]
+ [bodyI (translate bodyS)]
(wrap (|>. (pop-altI stack-depth)
bodyI
($i;GOTO @end))))
@@ -111,7 +111,7 @@
(^template [<special> <method>]
(^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)] subP))])
(do meta;Monad<Meta>
- [subI (generate-path' generate stack-depth @else @end subP)]
+ [subI (translate-path' translate stack-depth @else @end subP)]
(wrap (case idx
+0
(|>. peekI
@@ -139,7 +139,7 @@
(^template [<special> <flag>]
(^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)] subP))])
(do meta;Monad<Meta>
- [subI (generate-path' generate stack-depth @else @end subP)]
+ [subI (translate-path' translate stack-depth @else @end subP)]
(wrap (<| $i;with-label (function [@success])
$i;with-label (function [@fail])
(|>. peekI
@@ -165,16 +165,16 @@
(^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftP rightP))])
(do meta;Monad<Meta>
- [leftI (generate-path' generate stack-depth @else @end leftP)
- rightI (generate-path' generate stack-depth @else @end rightP)]
+ [leftI (translate-path' translate stack-depth @else @end leftP)
+ rightI (translate-path' translate stack-depth @else @end rightP)]
(wrap (|>. leftI
rightI)))
(^ [_ (#;Form (list [_ (#;Text "lux case alt")] leftP rightP))])
(do meta;Monad<Meta>
[@alt-else $i;make-label
- leftI (generate-path' generate (n.inc stack-depth) @alt-else @end leftP)
- rightI (generate-path' generate stack-depth @else @end rightP)]
+ leftI (translate-path' translate (n.inc stack-depth) @alt-else @end leftP)
+ rightI (translate-path' translate stack-depth @else @end rightP)]
(wrap (|>. $i;DUP
leftI
($i;label @alt-else)
@@ -184,12 +184,12 @@
_
(_;throw Unrecognized-Path (%code path))))
-(def: (generate-path generate path @end)
+(def: (translate-path translate path @end)
(-> (-> ls;Synthesis (Meta $;Inst))
ls;Path $;Label (Meta $;Inst))
(do meta;Monad<Meta>
[@else $i;make-label
- pathI (generate-path' generate +1 @else @end path)]
+ pathI (translate-path' translate +1 @else @end path)]
(wrap (|>. pathI
($i;label @else)
$i;POP
@@ -200,13 +200,13 @@
$i;NULL
($i;GOTO @end)))))
-(def: #export (generate-case generate valueS path)
+(def: #export (translate-case translate valueS path)
(-> (-> ls;Synthesis (Meta $;Inst))
ls;Synthesis ls;Path (Meta $;Inst))
(do meta;Monad<Meta>
[@end $i;make-label
- valueI (generate valueS)
- pathI (generate-path generate path @end)]
+ valueI (translate valueS)
+ pathI (translate-path translate path @end)]
(wrap (|>. valueI
$i;NULL
$i;SWAP
@@ -214,12 +214,12 @@
pathI
($i;label @end)))))
-(def: #export (generate-let generate register inputS exprS)
+(def: #export (translate-let translate register inputS exprS)
(-> (-> ls;Synthesis (Meta $;Inst))
Nat ls;Synthesis ls;Synthesis (Meta $;Inst))
(do meta;Monad<Meta>
- [inputI (generate inputS)
- exprI (generate exprS)]
+ [inputI (translate inputS)
+ exprI (translate exprS)]
(wrap (|>. inputI
($i;ASTORE register)
exprI))))
diff --git a/new-luxc/source/luxc/lang/translation/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/expression.jvm.lux
index af66d4994..81cdc1261 100644
--- a/new-luxc/source/luxc/lang/translation/expression.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/expression.jvm.lux
@@ -22,54 +22,54 @@
(exception: #export Unrecognized-Synthesis)
-(def: #export (generate synthesis)
+(def: #export (translate synthesis)
(-> ls;Synthesis (Meta $;Inst))
(case synthesis
(^code [])
- primitiveT;generate-unit
+ primitiveT;translate-unit
(^code [(~ singleton)])
- (generate singleton)
+ (translate singleton)
(^template [<tag> <generator>]
[_ (<tag> value)]
(<generator> value))
- ([#;Bool primitiveT;generate-bool]
- [#;Nat primitiveT;generate-nat]
- [#;Int primitiveT;generate-int]
- [#;Deg primitiveT;generate-deg]
- [#;Frac primitiveT;generate-frac]
- [#;Text primitiveT;generate-text])
+ ([#;Bool primitiveT;translate-bool]
+ [#;Nat primitiveT;translate-nat]
+ [#;Int primitiveT;translate-int]
+ [#;Deg primitiveT;translate-deg]
+ [#;Frac primitiveT;translate-frac]
+ [#;Text primitiveT;translate-text])
(^code ((~ [_ (#;Nat tag)]) (~ [_ (#;Bool last?)]) (~ valueS)))
- (structureT;generate-variant generate tag last? valueS)
+ (structureT;translate-variant translate tag last? valueS)
(^code [(~@ members)])
- (structureT;generate-tuple generate members)
+ (structureT;translate-tuple translate members)
(^ [_ (#;Form (list [_ (#;Int var)]))])
(if (variableL;captured? var)
- (referenceT;generate-captured var)
- (referenceT;generate-variable var))
+ (referenceT;translate-captured var)
+ (referenceT;translate-variable var))
[_ (#;Symbol definition)]
- (referenceT;generate-definition definition)
+ (referenceT;translate-definition definition)
(^code ("lux let" (~ [_ (#;Nat register)]) (~ inputS) (~ exprS)))
- (caseT;generate-let generate register inputS exprS)
+ (caseT;translate-let translate register inputS exprS)
(^code ("lux case" (~ inputS) (~ pathPS)))
- (caseT;generate-case generate inputS pathPS)
+ (caseT;translate-case translate inputS pathPS)
(^multi (^code ("lux function" (~ [_ (#;Nat arity)]) [(~@ environment)] (~ bodyS)))
[(s;run environment (p;some s;int)) (#e;Success environment)])
- (functionT;generate-function generate environment arity bodyS)
+ (functionT;translate-function translate environment arity bodyS)
(^code ("lux call" (~ functionS) (~@ argsS)))
- (functionT;generate-call generate functionS argsS)
+ (functionT;translate-call translate functionS argsS)
(^code ((~ [_ (#;Text procedure)]) (~@ argsS)))
- (procedureT;generate-procedure generate procedure argsS)
+ (procedureT;translate-procedure translate procedure argsS)
_
(&;throw Unrecognized-Synthesis (%code synthesis))
diff --git a/new-luxc/source/luxc/lang/translation/function.jvm.lux b/new-luxc/source/luxc/lang/translation/function.jvm.lux
index 35c88e4ed..ebdb28853 100644
--- a/new-luxc/source/luxc/lang/translation/function.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/function.jvm.lux
@@ -266,13 +266,13 @@
$i;ARETURN
))))
-(def: #export (with-function generate class env arity body)
+(def: #export (with-function translate class env arity body)
(-> (-> ls;Synthesis (Meta $;Inst))
Text (List Variable) ls;Arity ls;Synthesis
(Meta [$;Def $;Inst]))
(do meta;Monad<Meta>
[@begin $i;make-label
- bodyI (commonT;with-function class (generate body))
+ bodyI (commonT;with-function class (translate body))
#let [env-size (list;size env)
applyD (: $;Def
(if (poly-arg? arity)
@@ -295,13 +295,13 @@
instanceI (instance class arity env)]]
(wrap [functionD instanceI])))
-(def: #export (generate-function generate env arity body)
+(def: #export (translate-function translate env arity body)
(-> (-> ls;Synthesis (Meta $;Inst))
(List Variable) ls;Arity ls;Synthesis
(Meta $;Inst))
(do meta;Monad<Meta>
[function-class (:: @ map %code (meta;gensym "function"))
- [functionD instanceI] (with-function generate function-class env arity body)
+ [functionD instanceI] (with-function translate function-class env arity body)
_ (commonT;store-class function-class
($d;class #$;V1.6 #$;Public $;finalC
function-class (list)
@@ -316,13 +316,13 @@
(list pre)
(list& pre (segment size post)))))
-(def: #export (generate-call generate functionS argsS)
+(def: #export (translate-call translate functionS argsS)
(-> (-> ls;Synthesis (Meta $;Inst))
ls;Synthesis (List ls;Synthesis)
(Meta $;Inst))
(do meta;Monad<Meta>
- [functionI (generate functionS)
- argsI (monad;map @ generate argsS)
+ [functionI (translate functionS)
+ argsI (monad;map @ translate argsS)
#let [applyI (|> (segment runtimeT;num-apply-variants argsI)
(list/map (function [chunkI+]
(|>. ($i;CHECKCAST hostL;function-class)
diff --git a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux
index 72b5f4e9d..f795a2980 100644
--- a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux
@@ -13,11 +13,11 @@
(translation [";T" common])))
[../runtime])
-(def: #export generate-unit
+(def: #export translate-unit
(Meta $;Inst)
(meta/wrap ($i;string hostL;unit)))
-(def: #export (generate-bool value)
+(def: #export (translate-bool value)
(-> Bool (Meta $;Inst))
(meta/wrap ($i;GETSTATIC "java.lang.Boolean"
(if value "TRUE" "FALSE")
@@ -28,9 +28,9 @@
(-> <type> (Meta $;Inst))
(meta/wrap (|>. (<load> value) <wrap>)))]
- [generate-nat Nat (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
- [generate-int Int $i;long ($i;wrap #$;Long)]
- [generate-deg Deg (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
- [generate-frac Frac $i;double ($i;wrap #$;Double)]
- [generate-text Text $i;string id]
+ [translate-nat Nat (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
+ [translate-int Int $i;long ($i;wrap #$;Long)]
+ [translate-deg Deg (|>. (:! Int) $i;long) ($i;wrap #$;Long)]
+ [translate-frac Frac $i;double ($i;wrap #$;Double)]
+ [translate-text Text $i;string id]
)
diff --git a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux
index 973f0e968..d74b559cf 100644
--- a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux
@@ -15,10 +15,10 @@
(|> ./common;procedures
(dict;merge ./host;procedures)))
-(def: #export (generate-procedure generate name args)
+(def: #export (translate-procedure translate name args)
(-> (-> ls;Synthesis (Meta $;Inst)) Text (List ls;Synthesis)
(Meta $;Inst))
(<| (maybe;default (&;fail (format "Unknown procedure: " (%t name))))
(do maybe;Monad<Maybe>
[proc (dict;get name procedures)]
- (wrap (proc generate args)))))
+ (wrap (proc translate args)))))
diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
index 80becb058..8c7668383 100644
--- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux
@@ -74,20 +74,20 @@
" Actual: " (|> actual nat-to-int %i)))
(syntax: (arity: [name s;local-symbol] [arity s;nat])
- (with-gensyms [g!proc g!name g!generate g!inputs]
+ (with-gensyms [g!proc g!name g!translate g!inputs]
(do @
[g!input+ (monad;seq @ (list;repeat arity (meta;gensym "input")))]
(wrap (list (` (def: #export ((~ (code;local-symbol name)) (~ g!proc))
(-> (-> (;;Vector (~ (code;nat arity)) $;Inst) $;Inst)
(-> Text ;;Proc))
(function [(~ g!name)]
- (function [(~ g!generate) (~ g!inputs)]
+ (function [(~ g!translate) (~ g!inputs)]
(case (~ g!inputs)
(^ (list (~@ g!input+)))
(do meta;Monad<Meta>
[(~@ (|> g!input+
(list/map (function [g!input]
- (list g!input (` ((~ g!generate) (~ g!input))))))
+ (list g!input (` ((~ g!translate) (~ g!input))))))
list;concat))]
((~' wrap) ((~ g!proc) [(~@ g!input+)])))
diff --git a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux
index c222e42cf..7168514c1 100644
--- a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux
@@ -273,12 +273,12 @@
$i;I2L
($i;wrap #$;Long)))
-(def: (array//new proc generate inputs)
+(def: (array//new proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Nat level)] [_ (#;Text class)] lengthS))
(do meta;Monad<Meta>
- [lengthI (generate lengthS)
+ [lengthI (translate lengthS)
#let [arrayJT ($t;array level (case class
"boolean" $t;boolean
"byte" $t;byte
@@ -297,13 +297,13 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (array//read proc generate inputs)
+(def: (array//read proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] idxS arrayS))
(do meta;Monad<Meta>
- [arrayI (generate arrayS)
- idxI (generate idxS)
+ [arrayI (translate arrayS)
+ idxI (translate idxS)
#let [loadI (case class
"boolean" (|>. $i;BALOAD ($i;wrap #$;Boolean))
"byte" (|>. $i;BALOAD ($i;wrap #$;Byte))
@@ -323,14 +323,14 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (array//write proc generate inputs)
+(def: (array//write proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] idxS valueS arrayS))
(do meta;Monad<Meta>
- [arrayI (generate arrayS)
- idxI (generate idxS)
- valueI (generate valueS)
+ [arrayI (translate arrayS)
+ idxI (translate idxS)
+ valueI (translate valueS)
#let [storeI (case class
"boolean" (|>. ($i;unwrap #$;Boolean) $i;BASTORE)
"byte" (|>. ($i;unwrap #$;Byte) $i;BASTORE)
@@ -392,7 +392,7 @@
(|>. exceptionI
$i;ATHROW))
-(def: (object//class proc generate inputs)
+(def: (object//class proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)]))
@@ -408,12 +408,12 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (object//instance? proc generate inputs)
+(def: (object//instance? proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] objectS))
(do meta;Monad<Meta>
- [objectI (generate objectS)]
+ [objectI (translate objectS)]
(wrap (|>. objectI
($i;INSTANCEOF class)
($i;wrap #$;Boolean))))
@@ -445,7 +445,7 @@
["char" #$;Char])
(dict;from-list text;Hash<Text>)))
-(def: (static//get proc generate inputs)
+(def: (static//get proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)]))
@@ -472,12 +472,12 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (static//put proc generate inputs)
+(def: (static//put proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS))
(do meta;Monad<Meta>
- [valueI (generate valueS)]
+ [valueI (translate valueS)]
(case (dict;get unboxed primitives)
(#;Some primitive)
(let [primitive (case unboxed
@@ -504,12 +504,12 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (virtual//get proc generate inputs)
+(def: (virtual//get proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] objectS))
(do meta;Monad<Meta>
- [objectI (generate objectS)]
+ [objectI (translate objectS)]
(case (dict;get unboxed primitives)
(#;Some primitive)
(let [primitive (case unboxed
@@ -535,13 +535,13 @@
_
(&;fail (format "Wrong syntax for '" proc "'."))))
-(def: (virtual//put proc generate inputs)
+(def: (virtual//put proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS objectS))
(do meta;Monad<Meta>
- [valueI (generate valueS)
- objectI (generate objectS)]
+ [valueI (translate valueS)
+ objectI (translate objectS)]
(case (dict;get unboxed primitives)
(#;Some primitive)
(let [primitive (case unboxed
@@ -597,7 +597,7 @@
nesting (p;some (l;this "[]"))]
(wrap ($t;array (list;size nesting) raw))))
-(def: (generate-type argD)
+(def: (translate-type argD)
(-> Text (Meta $;Type))
(case (l;run argD java-type)
(#e;Error error)
@@ -623,7 +623,7 @@
_
(|>. inputI ($i;CHECKCAST ($t;descriptor inputT)))))
-(def: (generate-args generate argsS)
+(def: (translate-args translate argsS)
(-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis)
(Meta (List [$;Type $;Inst])))
(case argsS
@@ -632,9 +632,9 @@
(^ (list& [_ (#;Tuple (list [_ (#;Text argD)] argS))] tail))
(do meta;Monad<Meta>
- [argT (generate-type argD)
- argI (:: @ map (prepare-input argT) (generate argS))
- =tail (generate-args generate tail)]
+ [argT (translate-type argD)
+ argI (:: @ map (prepare-input argT) (translate argS))
+ =tail (translate-args translate tail)]
(wrap (list& [argT argI] =tail)))
_
@@ -647,7 +647,7 @@
(meta/wrap #;None)
_
- (:: meta;Monad<Meta> map (|>. #;Some) (generate-type description))))
+ (:: meta;Monad<Meta> map (|>. #;Some) (translate-type description))))
(def: (prepare-return returnT returnI)
(-> (Maybe $;Type) $;Inst $;Inst)
@@ -664,13 +664,13 @@
_
returnI)))
-(def: (invoke//static proc generate inputs)
+(def: (invoke//static proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list& [_ (#;Text class)] [_ (#;Text method)]
[_ (#;Text unboxed)] argsS))
(do meta;Monad<Meta>
- [argsTI (generate-args generate argsS)
+ [argsTI (translate-args translate argsS)
returnT (method-return-type unboxed)
#let [callI (|>. ($i;fuse (list/map product;right argsTI))
($i;INVOKESTATIC class method
@@ -682,14 +682,14 @@
(&;fail (format "Wrong syntax for '" proc "'."))))
(do-template [<name> <invoke> <interface?>]
- [(def: (<name> proc generate inputs)
+ [(def: (<name> proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list& [_ (#;Text class)] [_ (#;Text method)]
[_ (#;Text unboxed)] objectS argsS))
(do meta;Monad<Meta>
- [objectI (generate objectS)
- argsTI (generate-args generate argsS)
+ [objectI (translate objectS)
+ argsTI (translate-args translate argsS)
returnT (method-return-type unboxed)
#let [callI (|>. objectI
($i;CHECKCAST class)
@@ -707,12 +707,12 @@
[invoke//interface $i;INVOKEINTERFACE true]
)
-(def: (invoke//constructor proc generate inputs)
+(def: (invoke//constructor proc translate inputs)
(-> Text @;Proc)
(case inputs
(^ (list& [_ (#;Text class)] argsS))
(do meta;Monad<Meta>
- [argsTI (generate-args generate argsS)]
+ [argsTI (translate-args translate argsS)]
(wrap (|>. ($i;NEW class)
$i;DUP
($i;fuse (list/map product;right argsTI))
diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux
index 7c42f9f08..da86dd5b9 100644
--- a/new-luxc/source/luxc/lang/translation/reference.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/reference.jvm.lux
@@ -12,7 +12,7 @@
(translation [";T" common]
[";T" function]))))
-(def: #export (generate-captured variable)
+(def: #export (translate-captured variable)
(-> Variable (Meta $;Inst))
(do meta;Monad<Meta>
[function-class commonT;function]
@@ -21,11 +21,11 @@
(|> variable i.inc (i.* -1) int-to-nat functionT;captured)
commonT;$Object)))))
-(def: #export (generate-variable variable)
+(def: #export (translate-variable variable)
(-> Variable (Meta $;Inst))
(meta/wrap ($i;ALOAD (int-to-nat variable))))
-(def: #export (generate-definition [def-module def-name])
+(def: #export (translate-definition [def-module def-name])
(-> Ident (Meta $;Inst))
(let [bytecode-name (format def-module "/" (&;normalize-name def-name))]
(meta/wrap ($i;GETSTATIC bytecode-name commonT;value-field commonT;$Object))))
diff --git a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
index e5d237fc7..0a330ab73 100644
--- a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux
@@ -449,7 +449,7 @@
$i;ARETURN)
update-tagI (|>. $i;ISUB ($i;ISTORE +1))
update-variantI (|>. ($i;ALOAD +0) datumI ($i;CHECKCAST ($t;descriptor $Variant)) ($i;ASTORE +0))
- wrongI (|>. $i;NULL $i;ARETURN)
+ failureI (|>. $i;NULL $i;ARETURN)
return-datumI (|>. ($i;ALOAD +0) datumI $i;ARETURN)])
(|>. ($i;label @begin)
($i;ILOAD +1) ## tag
@@ -458,7 +458,7 @@
$i;DUP2 ($i;IF_ICMPGT @further)
$i;DUP2 ($i;IF_ICMPLT @shorten)
## $i;POP2
- wrongI
+ failureI
($i;label @then) ## tag, sumT
($i;ALOAD +2) ## tag, sumT, wants-last?
($i;ALOAD +0) flagI ## tag, sumT, wants-last?, is-last?
@@ -478,7 +478,7 @@
shortenI
($i;label @wrong) ## tag, sumT
## $i;POP2
- wrongI)))
+ failureI)))
($d;method #$;Public $;staticM "pm_left" ($t;method (list $Tuple $t;int) (#;Some $Object) (list))
(<| $i;with-label (function [@begin])
$i;with-label (function [@not-recursive])
@@ -555,7 +555,7 @@
$i;ARETURN)))
)))
-(def: generate-runtime
+(def: translate-runtime
(Meta commonT;Bytecode)
(do meta;Monad<Meta>
[_ (wrap [])
@@ -569,7 +569,7 @@
_ (commonT;store-class hostL;runtime-class bytecode)]
(wrap bytecode)))
-(def: generate-function
+(def: translate-function
(Meta commonT;Bytecode)
(do meta;Monad<Meta>
[_ (wrap [])
@@ -600,9 +600,9 @@
_ (commonT;store-class hostL;function-class bytecode)]
(wrap bytecode)))
-(def: #export generate
+(def: #export translate
(Meta [commonT;Bytecode commonT;Bytecode])
(do meta;Monad<Meta>
- [runtime-bc generate-runtime
- function-bc generate-function]
+ [runtime-bc translate-runtime
+ function-bc translate-function]
(wrap [runtime-bc function-bc])))
diff --git a/new-luxc/source/luxc/lang/translation/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/statement.jvm.lux
index 0234d738c..feb64c293 100644
--- a/new-luxc/source/luxc/lang/translation/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/statement.jvm.lux
@@ -31,7 +31,7 @@
(host;import (java.lang.Class c)
(getField [String] #try Field))
-(def: #export (generate-def def-name valueT valueI metaI metaV)
+(def: #export (translate-def def-name valueT valueI metaI metaV)
(-> Text Type $;Inst $;Inst Code (Meta Unit))
(do meta;Monad<Meta>
[current-module meta;current-module-name
@@ -75,7 +75,7 @@
#let [_ (log! (format "DEF " current-module ";" def-name))]]
(commonT;record-artifact bytecode-name bytecode)))
-(def: #export (generate-program program-args programI)
+(def: #export (translate-program program-args programI)
(-> Text $;Inst (Meta Unit))
(do meta;Monad<Meta>
[]
diff --git a/new-luxc/source/luxc/lang/translation/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/structure.jvm.lux
index c3e07fd55..3ef03ac2c 100644
--- a/new-luxc/source/luxc/lang/translation/structure.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/structure.jvm.lux
@@ -18,17 +18,17 @@
(def: $Object $;Type ($t;class "java.lang.Object" (list)))
-(def: #export (generate-tuple generate members)
+(def: #export (translate-tuple translate members)
(-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta $;Inst))
(do meta;Monad<Meta>
[#let [size (list;size members)]
- _ (&;assert "Cannot generate tuples with less than 2 elements."
+ _ (&;assert "Cannot translate tuples with less than 2 elements."
(n.>= +2 size))
membersI (|> members
list;enumerate
(monad;map @ (function [[idx member]]
(do @
- [memberI (generate member)]
+ [memberI (translate member)]
(wrap (|>. $i;DUP
($i;int (nat-to-int idx))
memberI
@@ -44,10 +44,10 @@
($i;string "")
$i;NULL))
-(def: #export (generate-variant generate tag tail? member)
+(def: #export (translate-variant translate tag tail? member)
(-> (-> ls;Synthesis (Meta $;Inst)) Nat Bool ls;Synthesis (Meta $;Inst))
(do meta;Monad<Meta>
- [memberI (generate member)]
+ [memberI (translate member)]
(wrap (|>. ($i;int (nat-to-int tag))
(flagI tail?)
memberI
diff --git a/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux
index cda281e04..0f8848a21 100644
--- a/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux
+++ b/new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux
@@ -34,7 +34,7 @@
[(def: (<name> procedure params output-type)
(-> Text (List Code) Type Bool)
(|> (do Monad<Meta>
- [runtime-bytecode @runtime;generate]
+ [runtime-bytecode @runtime;translate]
(&;with-scope
(&;with-expected-type output-type
(@;analyse-procedure analyse evalL;eval procedure params))))
diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux
index 78107ecb6..e93068ea3 100644
--- a/new-luxc/test/test/luxc/lang/analysis/type.lux
+++ b/new-luxc/test/test/luxc/lang/analysis/type.lux
@@ -53,7 +53,7 @@
($_ seq
(test (format "Can analyse type-checking.")
(|> (do Monad<Meta>
- [runtime-bytecode @runtime;generate]
+ [runtime-bytecode @runtime;translate]
(&;with-scope
(@common;with-unknown-type
(@;analyse-check analyse eval;eval typeC exprC))))
@@ -78,7 +78,7 @@
false)))
(test (format "Can analyse type-coercion.")
(|> (do Monad<Meta>
- [runtime-bytecode @runtime;generate]
+ [runtime-bytecode @runtime;translate]
(&;with-scope
(@common;with-unknown-type
(@;analyse-coerce analyse eval;eval typeC exprC))))
diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux
index 3a8608ea7..ace2e0290 100644
--- a/new-luxc/test/test/luxc/lang/translation/case.lux
+++ b/new-luxc/test/test/luxc/lang/translation/case.lux
@@ -68,16 +68,16 @@
[[valueS pathS] gen-case
to-bind r;nat]
($_ seq
- (test "Can generate pattern-matching."
+ (test "Can translate pattern-matching."
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (@;generate-case expressionT;generate
- valueS
- (` ("lux case alt"
- ("lux case seq" (~ pathS)
- ("lux case exec" true))
- ("lux case seq" ("lux case bind" +0)
- ("lux case exec" false)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (@;translate-case expressionT;translate
+ valueS
+ (` ("lux case alt"
+ ("lux case seq" (~ pathS)
+ ("lux case exec" true))
+ ("lux case seq" ("lux case bind" +0)
+ ("lux case exec" false)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -87,11 +87,11 @@
false)))
(test "Can bind values."
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (@;generate-case expressionT;generate
- (code;nat to-bind)
- (` ("lux case seq" ("lux case bind" +0)
- ("lux case exec" (0)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (@;translate-case expressionT;translate
+ (code;nat to-bind)
+ (` ("lux case seq" ("lux case bind" +0)
+ ("lux case exec" (0)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
diff --git a/new-luxc/test/test/luxc/lang/translation/function.lux b/new-luxc/test/test/luxc/lang/translation/function.lux
index 1896adff3..999f4f432 100644
--- a/new-luxc/test/test/luxc/lang/translation/function.lux
+++ b/new-luxc/test/test/luxc/lang/translation/function.lux
@@ -48,8 +48,8 @@
($_ seq
(test "Can read arguments."
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` ("lux call" (~ functionS) (~@ argsS))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` ("lux call" (~ functionS) (~@ argsS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -63,10 +63,10 @@
[#let [partial-arity (n.inc cut-off)
preS (list;take partial-arity argsS)
postS (list;drop partial-arity argsS)]
- runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` ("lux call"
- ("lux call" (~ functionS) (~@ preS))
- (~@ postS))))]
+ runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` ("lux call"
+ ("lux call" (~ functionS) (~@ preS))
+ (~@ postS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -87,8 +87,8 @@
functionS (` ("lux function" (~ (code;nat super-arity)) []
("lux function" (~ (code;nat sub-arity)) [(~@ (list/map code;int env))]
((~ (code;int arg-var))))))]
- runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` ("lux call" (~ functionS) (~@ argsS))))]
+ runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` ("lux call" (~ functionS) (~@ argsS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux
index 8604ed369..e8aaddb5a 100644
--- a/new-luxc/test/test/luxc/lang/translation/primitive.lux
+++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux
@@ -30,9 +30,9 @@
%text% (r;text +5)]
(with-expansions
[<tests> (do-template [<desc> <type> <synthesis> <sample> <test>]
- [(test (format "Can generate " <desc> ".")
+ [(test (format "Can translate " <desc> ".")
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (<synthesis> <sample>))]
+ [sampleI (expressionT;translate (<synthesis> <sample>))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -48,9 +48,9 @@
["frac" Frac code;frac %frac% f.=]
["text" Text code;text %text% T/=])]
($_ seq
- (test "Can generate unit."
+ (test "Can translate unit."
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (' []))]
+ [sampleI (expressionT;translate (' []))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
diff --git a/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux
index 8c44007d0..e15627851 100644
--- a/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux
+++ b/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux
@@ -31,8 +31,8 @@
(with-expansions [<binary> (do-template [<name> <reference>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name> (~ (code;nat subject))
- (~ (code;nat param)))))]
+ [sampleI (expressionT;translate (` (<name> (~ (code;nat subject))
+ (~ (code;nat param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -50,7 +50,7 @@
($_ seq
(test "bit count"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("bit count" (~ (code;nat subject)))))]
+ [sampleI (expressionT;translate (` ("bit count" (~ (code;nat subject)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -62,9 +62,9 @@
<binary>
(test "bit shift-right"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("bit shift-right"
- (~ (code;int (nat-to-int subject)))
- (~ (code;nat param)))))]
+ [sampleI (expressionT;translate (` ("bit shift-right"
+ (~ (code;int (nat-to-int subject)))
+ (~ (code;nat param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -84,7 +84,7 @@
(~~ (do-template [<name> <reference>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name>)))]
+ [sampleI (expressionT;translate (` (<name>)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -99,7 +99,7 @@
(~~ (do-template [<name> <type> <prepare> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name> (~ (code;nat subject)))))]
+ [sampleI (expressionT;translate (` (<name> (~ (code;nat subject)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -114,8 +114,8 @@
(~~ (do-template [<name> <reference> <outputT> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;nat subject)) (~ (code;nat param)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;nat subject)) (~ (code;nat param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -142,7 +142,7 @@
(with-expansions [<nullary> (do-template [<name> <reference>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name>)))]
+ [sampleI (expressionT;translate (` (<name>)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -157,7 +157,7 @@
<unary> (do-template [<name> <type> <prepare> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name> (~ (code;int subject)))))]
+ [sampleI (expressionT;translate (` (<name> (~ (code;int subject)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -172,8 +172,8 @@
<binary> (do-template [<name> <reference> <outputT> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;int subject)) (~ (code;int param)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;int subject)) (~ (code;int param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -204,8 +204,8 @@
(with-expansions [<binary> (do-template [<name> <reference> <outputT> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;frac subject)) (~ (code;frac param)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;frac subject)) (~ (code;frac param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -234,7 +234,7 @@
(with-expansions [<nullary> (do-template [<name> <test>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name>)))]
+ [sampleI (expressionT;translate (` (<name>)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -253,8 +253,8 @@
<unary> (do-template [<name> <type> <prepare> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;frac subject)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;frac subject)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -271,8 +271,8 @@
<unary>
(test "frac encode|decode"
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` ("frac decode" ("frac encode" (~ (code;frac subject))))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` ("frac decode" ("frac encode" (~ (code;frac subject))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (^multi (#e;Success valueT)
@@ -300,7 +300,7 @@
(~~ (do-template [<name> <reference>]
[(test <name>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<name>)))]
+ [sampleI (expressionT;translate (` (<name>)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -315,8 +315,8 @@
(~~ (do-template [<name> <type> <prepare> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;deg subject)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;deg subject)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -330,8 +330,8 @@
(~~ (do-template [<name> <reference> <outputT> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;deg subject)) (~ (code;deg param)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;deg subject)) (~ (code;deg param)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -351,8 +351,8 @@
(~~ (do-template [<name> <reference> <outputT> <comp>]
[(test <name>
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` (<name> (~ (code;deg subject)) (~ (code;nat special)))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` (<name> (~ (code;deg subject)) (~ (code;nat special)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
diff --git a/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux
index 35453c44b..0dd539120 100644
--- a/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux
+++ b/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux
@@ -32,7 +32,7 @@
(with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>]
[(test (format <step1> " / " <step2>)
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))]
+ [sampleI (expressionT;translate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -63,7 +63,7 @@
(~~ (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>]
[(test (format <step1> " / " <step2> " / " <step3>)
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))]
+ [sampleI (expressionT;translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -89,7 +89,7 @@
(~~ (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>]
[(test (format <step1> " / " <step2> " / " <step3>)
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))]
+ [sampleI (expressionT;translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -127,9 +127,9 @@
(with-expansions [<tests> (do-template [<procedure> <reference>]
[(test <procedure>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<post> ((~ (code;text <procedure>))
- (<pre> (~ (<tag> subject)))
- (<pre> (~ (<tag> param)))))))]
+ [sampleI (expressionT;translate (` (<post> ((~ (code;text <procedure>))
+ (<pre> (~ (<tag> subject)))
+ (<pre> (~ (<tag> param)))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -165,9 +165,9 @@
(~~ (do-template [<procedure> <reference>]
[(test <procedure>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<post> ((~ (code;text <procedure>))
- (<convert> (~ (code;nat subject)))
- (<convert> (~ (code;nat param)))))))]
+ [sampleI (expressionT;translate (` (<post> ((~ (code;text <procedure>))
+ (<convert> (~ (code;nat subject)))
+ (<convert> (~ (code;nat param)))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -198,9 +198,9 @@
(~~ (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>]
[(test <procedure>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` (<post> ((~ (code;text <procedure>))
- (<convert> (~ (<pre> subject)))
- ("jvm convert long-to-int" (~ (code;nat shift)))))))]
+ [sampleI (expressionT;translate (` (<post> ((~ (code;text <procedure>))
+ (<convert> (~ (<pre> subject)))
+ ("jvm convert long-to-int" (~ (code;nat shift)))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -229,9 +229,9 @@
(with-expansions [<tests> (do-template [<procedure> <reference>]
[(test <procedure>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ((~ (code;text <procedure>))
- (<pre> (~ (<tag> subject)))
- (<pre> (~ (<tag> param))))))]
+ [sampleI (expressionT;translate (` ((~ (code;text <procedure>))
+ (<pre> (~ (<tag> subject)))
+ (<pre> (~ (<tag> param))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -283,12 +283,12 @@
(with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>]
[(test <class>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (|> (jvm//array//new +0 <class> size)
- (jvm//array//write <class> idx <input>)
- (jvm//array//read <class> idx)
- (~)
- <post>
- (`)))]
+ [sampleI (expressionT;translate (|> (jvm//array//new +0 <class> size)
+ (jvm//array//write <class> idx <input>)
+ (jvm//array//read <class> idx)
+ (~)
+ <post>
+ (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputZ)
@@ -332,12 +332,12 @@
(with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>]
[(test <class>
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (|> (jvm//array//new +0 <class> size)
- (jvm//array//write <class> idx <input>)
- (jvm//array//read <class> idx)
- (~)
- <post>
- (`)))]
+ [sampleI (expressionT;translate (|> (jvm//array//new +0 <class> size)
+ (jvm//array//write <class> idx <input>)
+ (jvm//array//read <class> idx)
+ (~)
+ <post>
+ (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -360,11 +360,11 @@
[#let [inner (|> ("jvm array new" +0 "java.lang.Double" (~ (code;nat size)))
("jvm array write" "java.lang.Double" (~ (code;nat idx)) (~ (code;frac valueD)))
(`))]
- sampleI (expressionT;generate (|> ("jvm array new" +1 "java.lang.Double" (~ (code;nat size)))
- ("jvm array write" "#Array" (~ (code;nat idx)) (~ inner))
- ("jvm array read" "#Array" (~ (code;nat idx)))
- ("jvm array read" "java.lang.Double" (~ (code;nat idx)))
- (`)))]
+ sampleI (expressionT;translate (|> ("jvm array new" +1 "java.lang.Double" (~ (code;nat size)))
+ ("jvm array write" "#Array" (~ (code;nat idx)) (~ inner))
+ ("jvm array read" "#Array" (~ (code;nat idx)))
+ ("jvm array read" "java.lang.Double" (~ (code;nat idx)))
+ (`)))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -374,7 +374,7 @@
false)))
(test "jvm array length"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code;nat size))))))]
+ [sampleI (expressionT;translate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code;nat size))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -424,7 +424,7 @@
($_ seq
(test "jvm object null"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm object null?" ("jvm object null"))))]
+ [sampleI (expressionT;translate (` ("jvm object null?" ("jvm object null"))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -434,7 +434,7 @@
false)))
(test "jvm object null?"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm object null?" (~ (code;int sample)))))]
+ [sampleI (expressionT;translate (` ("jvm object null?" (~ (code;int sample)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -444,7 +444,7 @@
false)))
(test "jvm object synchronized"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm object synchronized" (~ (code;int monitor)) (~ (code;int sample)))))]
+ [sampleI (expressionT;translate (` ("jvm object synchronized" (~ (code;int monitor)) (~ (code;int sample)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -454,11 +454,11 @@
false)))
(test "jvm object throw"
(|> (do meta;Monad<Meta>
- [_ @runtime;generate
- sampleI (expressionT;generate (` ("lux try" ("lux function" +1 []
- ("jvm object throw" ("jvm member invoke constructor"
- "java.lang.Throwable"
- (~ exception-message$)))))))]
+ [_ @runtime;translate
+ sampleI (expressionT;translate (` ("lux try" ("lux function" +1 []
+ ("jvm object throw" ("jvm member invoke constructor"
+ "java.lang.Throwable"
+ (~ exception-message$)))))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -473,7 +473,7 @@
false)))
(test "jvm object class"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm object class" (~ (code;text class)))))]
+ [sampleI (expressionT;translate (` ("jvm object class" (~ (code;text class)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -483,7 +483,7 @@
false)))
(test "jvm object instance?"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm object instance?" (~ (code;text instance-class)) (~ instance))))]
+ [sampleI (expressionT;translate (` ("jvm object instance?" (~ (code;text instance-class)) (~ instance))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -513,7 +513,7 @@
($_ seq
(test "jvm member static get"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm convert int-to-long" ("jvm member static get" "java.util.GregorianCalendar" "AD" "int"))))]
+ [sampleI (expressionT;translate (` ("jvm convert int-to-long" ("jvm member static get" "java.util.GregorianCalendar" "AD" "int"))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -523,8 +523,8 @@
false)))
(test "jvm member static put"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member static put" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor"
- ("jvm member static get" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor"))))]
+ [sampleI (expressionT;translate (` ("jvm member static put" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor"
+ ("jvm member static get" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor"))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -534,7 +534,7 @@
false)))
(test "jvm member virtual get"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))]
+ [sampleI (expressionT;translate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -544,9 +544,9 @@
false)))
(test "jvm member virtual put"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String"
- ("jvm member virtual put" "org.omg.CORBA.ValueMember" "name" "java.lang.String"
- (~ (code;text other-sample-string)) (~ value-memberS)))))]
+ [sampleI (expressionT;translate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String"
+ ("jvm member virtual put" "org.omg.CORBA.ValueMember" "name" "java.lang.String"
+ (~ (code;text other-sample-string)) (~ value-memberS)))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -571,7 +571,7 @@
($_ seq
(test "jvm member invoke static"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member invoke static" "java.lang.Long" "decode" "java.lang.Long" (~ coded-intS))))]
+ [sampleI (expressionT;translate (` ("jvm member invoke static" "java.lang.Long" "decode" "java.lang.Long" (~ coded-intS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -581,8 +581,8 @@
false)))
(test "jvm member invoke virtual"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member invoke virtual" "java.lang.Object" "equals" "boolean"
- (~ (code;int sample)) (~ object-longS))))]
+ [sampleI (expressionT;translate (` ("jvm member invoke virtual" "java.lang.Object" "equals" "boolean"
+ (~ (code;int sample)) (~ object-longS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -592,8 +592,8 @@
false)))
(test "jvm member invoke interface"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (` ("jvm member invoke interface" "java.util.Collection" "add" "boolean"
- (~ array-listS) (~ object-longS))))]
+ [sampleI (expressionT;translate (` ("jvm member invoke interface" "java.util.Collection" "add" "boolean"
+ (~ array-listS) (~ object-longS))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
@@ -603,7 +603,7 @@
false)))
(test "jvm member invoke constructor"
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate array-listS)]
+ [sampleI (expressionT;translate array-listS)]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
diff --git a/new-luxc/test/test/luxc/lang/translation/reference.lux b/new-luxc/test/test/luxc/lang/translation/reference.lux
index 0bc2bb325..1aee7df46 100644
--- a/new-luxc/test/test/luxc/lang/translation/reference.lux
+++ b/new-luxc/test/test/luxc/lang/translation/reference.lux
@@ -47,8 +47,8 @@
(test "Can refer to definitions."
(|> (do meta;Monad<Meta>
[_ (_module;with-module +0 module-name
- (statementT;generate-def def-name Int valueI empty-metaI (' {})))
- sampleI (expressionT;generate (code;symbol [module-name def-name]))]
+ (statementT;translate-def def-name Int valueI empty-metaI (' {})))
+ sampleI (expressionT;translate (code;symbol [module-name def-name]))]
(evalT;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -66,10 +66,10 @@
($_ seq
(test "Can refer to local variables/registers."
(|> (do meta;Monad<Meta>
- [sampleI (caseT;generate-let expressionT;generate
- register
- (code;int value)
- (` ((~ (code;int (nat-to-int register))))))]
+ [sampleI (caseT;translate-let expressionT;translate
+ register
+ (code;int value)
+ (` ((~ (code;int (nat-to-int register))))))]
(evalT;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success outputT)
diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux
index a8f74ec6a..f32ab40e1 100644
--- a/new-luxc/test/test/luxc/lang/translation/structure.lux
+++ b/new-luxc/test/test/luxc/lang/translation/structure.lux
@@ -65,9 +65,9 @@
(do @
[size (|> r;nat (:: @ map (|>. (n.% +10) (n.max +2))))
members (r;list size gen-primitive)]
- (test "Can generate tuple."
+ (test "Can translate tuple."
(|> (do meta;Monad<Meta>
- [sampleI (expressionT;generate (code;tuple members))]
+ [sampleI (expressionT;translate (code;tuple members))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)
@@ -85,10 +85,10 @@
tag (|> r;nat (:: @ map (n.% num-tags)))
#let [last? (n.= (n.dec num-tags) tag)]
member gen-primitive]
- (test "Can generate variant."
+ (test "Can translate variant."
(|> (do meta;Monad<Meta>
- [runtime-bytecode @runtime;generate
- sampleI (expressionT;generate (` ((~ (code;nat tag)) (~ (code;bool last?)) (~ member))))]
+ [runtime-bytecode @runtime;translate
+ sampleI (expressionT;translate (` ((~ (code;nat tag)) (~ (code;bool last?)) (~ member))))]
(@eval;eval sampleI))
(meta;run (init-compiler []))
(case> (#e;Success valueT)