diff options
Diffstat (limited to 'new-luxc/test')
-rw-r--r-- | new-luxc/test/test/luxc/common.lux | 4 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/analysis/procedure/host.jvm.lux | 4 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/analysis/type.lux | 4 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/case.lux (renamed from new-luxc/test/test/luxc/generator/case.lux) | 24 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/function.lux (renamed from new-luxc/test/test/luxc/generator/function.lux) | 28 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/primitive.lux (renamed from new-luxc/test/test/luxc/generator/primitive.lux) | 22 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux (renamed from new-luxc/test/test/luxc/generator/procedure/common.jvm.lux) | 112 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux (renamed from new-luxc/test/test/luxc/generator/procedure/host.jvm.lux) | 158 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/reference.lux (renamed from new-luxc/test/test/luxc/generator/reference.lux) | 38 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/structure.lux (renamed from new-luxc/test/test/luxc/generator/structure.lux) | 34 | ||||
-rw-r--r-- | new-luxc/test/tests.lux | 16 |
11 files changed, 222 insertions, 222 deletions
diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 5b6fed8ec..84d912145 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -2,8 +2,8 @@ lux (lux [io]) (luxc ["&;" host] - [";G" generator])) + (lang [";L" translation]))) (def: #export (init-compiler _) (-> Top Compiler) - (generatorG;init-compiler (io;run &host;init-host))) + (translationL;init-compiler (io;run &host;init-host))) 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 333a60353..cda281e04 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 @@ -25,8 +25,8 @@ (analysis [";A" expression] ["@;" common] ["@" procedure] - (procedure ["@;" host]))) - (generator ["@;" runtime])) + (procedure ["@;" host])) + (translation ["@;" runtime]))) (../.. common) (test/luxc common)) diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index 649c33fef..78107ecb6 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -21,8 +21,8 @@ (lang ["~" analysis] (analysis [";A" expression] ["@" type] - ["@;" common])) - (generator ["@;" runtime]) + ["@;" common]) + (translation ["@;" runtime])) [eval]) (.. common) (test/luxc common)) diff --git a/new-luxc/test/test/luxc/generator/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index e4201a30b..3a8608ea7 100644 --- a/new-luxc/test/test/luxc/generator/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -10,12 +10,12 @@ [meta] (meta [code]) test) - (luxc (lang ["ls" synthesis]) - (generator ["@" case] - [";G" expression] - ["@;" eval] - ["@;" runtime] - ["@;" common])) + (luxc (lang ["ls" synthesis] + (translation ["@" case] + [";T" expression] + ["@;" eval] + ["@;" runtime] + ["@;" common]))) (test/luxc common)) (def: struct-limit Nat +10) @@ -71,7 +71,7 @@ (test "Can generate pattern-matching." (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (@;generate-case expressionG;generate + sampleI (@;generate-case expressionT;generate valueS (` ("lux case alt" ("lux case seq" (~ pathS) @@ -80,22 +80,22 @@ ("lux case exec" false)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (:! Bool valueG) + (case> (#e;Success valueT) + (:! Bool valueT) (#e;Error error) false))) (test "Can bind values." (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (@;generate-case expressionG;generate + sampleI (@;generate-case expressionT;generate (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 valueG) - (n.= to-bind (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= to-bind (:! Nat valueT)) _ false))))))) diff --git a/new-luxc/test/test/luxc/generator/function.lux b/new-luxc/test/test/luxc/lang/translation/function.lux index 2db2719b7..1896adff3 100644 --- a/new-luxc/test/test/luxc/generator/function.lux +++ b/new-luxc/test/test/luxc/lang/translation/function.lux @@ -13,11 +13,11 @@ (meta [code]) [host] test) - (luxc (lang ["ls" synthesis]) - (generator [";G" expression] - ["@;" eval] - ["@;" runtime] - ["@;" common])) + (luxc (lang ["ls" synthesis] + (translation [";T" expression] + ["@;" eval] + ["@;" runtime] + ["@;" common]))) (test/luxc common)) (def: arity-limit Nat +10) @@ -49,11 +49,11 @@ (test "Can read arguments." (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` ("lux call" (~ functionS) (~@ argsS))))] + sampleI (expressionT;generate (` ("lux call" (~ functionS) (~@ argsS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= arg-value (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= arg-value (:! Nat valueT)) (#e;Error error) false))) @@ -64,13 +64,13 @@ preS (list;take partial-arity argsS) postS (list;drop partial-arity argsS)] runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` ("lux call" + sampleI (expressionT;generate (` ("lux call" ("lux call" (~ functionS) (~@ preS)) (~@ postS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= arg-value (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= arg-value (:! Nat valueT)) (#e;Error error) false)))) @@ -88,11 +88,11 @@ ("lux function" (~ (code;nat sub-arity)) [(~@ (list/map code;int env))] ((~ (code;int arg-var))))))] runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` ("lux call" (~ functionS) (~@ argsS))))] + sampleI (expressionT;generate (` ("lux call" (~ functionS) (~@ argsS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= arg-value (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= arg-value (:! Nat valueT)) (#e;Error error) false)))) diff --git a/new-luxc/test/test/luxc/generator/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index 1ce93cee9..8604ed369 100644 --- a/new-luxc/test/test/luxc/generator/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -12,11 +12,11 @@ (meta [code]) test) (luxc [";L" host] - (lang ["ls" synthesis]) - (generator [";G" expression] - ["@;" runtime] - ["@;" eval] - ["@;" common])) + (lang ["ls" synthesis] + (translation [";T" expression] + ["@;" runtime] + ["@;" eval] + ["@;" common]))) (test/luxc common)) (context: "Primitives." @@ -32,11 +32,11 @@ [<tests> (do-template [<desc> <type> <synthesis> <sample> <test>] [(test (format "Can generate " <desc> ".") (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (<synthesis> <sample>))] + [sampleI (expressionT;generate (<synthesis> <sample>))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <type> valueG)) + (case> (#e;Success valueT) + (<test> <sample> (:! <type> valueT)) _ false)))] @@ -50,11 +50,11 @@ ($_ seq (test "Can generate unit." (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (' []))] + [sampleI (expressionT;generate (' []))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (is hostL;unit (:! Text valueG)) + (case> (#e;Success valueT) + (is hostL;unit (:! Text valueT)) _ false))) diff --git a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux b/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux index 0c24a4020..8c44007d0 100644 --- a/new-luxc/test/test/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux @@ -16,11 +16,11 @@ (meta [code]) [host] test) - (luxc (lang ["ls" synthesis]) - (generator [";G" expression] - ["@;" eval] - ["@;" runtime] - ["@;" common])) + (luxc (lang ["ls" synthesis] + (translation [";T" expression] + ["@;" eval] + ["@;" runtime] + ["@;" common]))) (test/luxc common)) (context: "Bit procedures" @@ -31,12 +31,12 @@ (with-expansions [<binary> (do-template [<name> <reference>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name> (~ (code;nat subject)) + [sampleI (expressionT;generate (` (<name> (~ (code;nat subject)) (~ (code;nat param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= (<reference> param subject) (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= (<reference> param subject) (:! Nat valueT)) _ false)))] @@ -50,11 +50,11 @@ ($_ seq (test "bit count" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("bit count" (~ (code;nat subject)))))] + [sampleI (expressionT;generate (` ("bit count" (~ (code;nat subject)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= (bit;count subject) (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= (bit;count subject) (:! Nat valueT)) _ false))) @@ -62,14 +62,14 @@ <binary> (test "bit shift-right" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("bit shift-right" + [sampleI (expressionT;generate (` ("bit shift-right" (~ (code;int (nat-to-int subject))) (~ (code;nat param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) + (case> (#e;Success valueT) (i.= (bit;signed-shift-right param (nat-to-int subject)) - (:! Int valueG)) + (:! Int valueT)) _ false))) @@ -84,11 +84,11 @@ (~~ (do-template [<name> <reference>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name>)))] + [sampleI (expressionT;generate (` (<name>)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (n.= <reference> (:! Nat valueG)) + (case> (#e;Success valueT) + (n.= <reference> (:! Nat valueT)) _ false)))] @@ -99,11 +99,11 @@ (~~ (do-template [<name> <type> <prepare> <comp>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name> (~ (code;nat subject)))))] + [sampleI (expressionT;generate (` (<name> (~ (code;nat subject)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<prepare> subject) (:! <type> valueG)) + (case> (#e;Success valueT) + (<comp> (<prepare> subject) (:! <type> valueT)) _ false)))] @@ -115,11 +115,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;nat subject)) (~ (code;nat param)))))] + sampleI (expressionT;generate (` (<name> (~ (code;nat subject)) (~ (code;nat param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<reference> param subject) (:! <outputT> valueG)) + (case> (#e;Success valueT) + (<comp> (<reference> param subject) (:! <outputT> valueT)) _ false)))] @@ -142,11 +142,11 @@ (with-expansions [<nullary> (do-template [<name> <reference>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name>)))] + [sampleI (expressionT;generate (` (<name>)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (i.= <reference> (:! Int valueG)) + (case> (#e;Success valueT) + (i.= <reference> (:! Int valueT)) _ false)))] @@ -157,11 +157,11 @@ <unary> (do-template [<name> <type> <prepare> <comp>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name> (~ (code;int subject)))))] + [sampleI (expressionT;generate (` (<name> (~ (code;int subject)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<prepare> subject) (:! <type> valueG)) + (case> (#e;Success valueT) + (<comp> (<prepare> subject) (:! <type> valueT)) _ false)))] @@ -173,11 +173,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;int subject)) (~ (code;int param)))))] + sampleI (expressionT;generate (` (<name> (~ (code;int subject)) (~ (code;int param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<reference> param subject) (:! <outputT> valueG)) + (case> (#e;Success valueT) + (<comp> (<reference> param subject) (:! <outputT> valueT)) _ false)))] @@ -205,11 +205,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;frac subject)) (~ (code;frac param)))))] + sampleI (expressionT;generate (` (<name> (~ (code;frac subject)) (~ (code;frac param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<reference> param subject) (:! <outputT> valueG)) + (case> (#e;Success valueT) + (<comp> (<reference> param subject) (:! <outputT> valueT)) _ false)))] @@ -234,11 +234,11 @@ (with-expansions [<nullary> (do-template [<name> <test>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name>)))] + [sampleI (expressionT;generate (` (<name>)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> (:! Frac valueG)) + (case> (#e;Success valueT) + (<test> (:! Frac valueT)) _ false)))] @@ -254,11 +254,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;frac subject)))))] + sampleI (expressionT;generate (` (<name> (~ (code;frac subject)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<prepare> subject) (:! <type> valueG)) + (case> (#e;Success valueT) + (<comp> (<prepare> subject) (:! <type> valueT)) _ false)))] @@ -272,11 +272,11 @@ (test "frac encode|decode" (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` ("frac decode" ("frac encode" (~ (code;frac subject))))))] + sampleI (expressionT;generate (` ("frac decode" ("frac encode" (~ (code;frac subject))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (^multi (#e;Success valueG) - [(:! (Maybe Frac) valueG) (#;Some value)]) + (case> (^multi (#e;Success valueT) + [(:! (Maybe Frac) valueT) (#;Some value)]) (f.= subject value) _ @@ -300,11 +300,11 @@ (~~ (do-template [<name> <reference>] [(test <name> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<name>)))] + [sampleI (expressionT;generate (` (<name>)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (d.= <reference> (:! Deg valueG)) + (case> (#e;Success valueT) + (d.= <reference> (:! Deg valueT)) _ false)))] @@ -316,11 +316,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;deg subject)))))] + sampleI (expressionT;generate (` (<name> (~ (code;deg subject)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<prepare> subject) (:! <type> valueG)) + (case> (#e;Success valueT) + (<comp> (<prepare> subject) (:! <type> valueT)) _ false)))] @@ -331,11 +331,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;deg subject)) (~ (code;deg param)))))] + sampleI (expressionT;generate (` (<name> (~ (code;deg subject)) (~ (code;deg param)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<reference> param subject) (:! <outputT> valueG)) + (case> (#e;Success valueT) + (<comp> (<reference> param subject) (:! <outputT> valueT)) _ false)))] @@ -352,11 +352,11 @@ [(test <name> (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` (<name> (~ (code;deg subject)) (~ (code;nat special)))))] + sampleI (expressionT;generate (` (<name> (~ (code;deg subject)) (~ (code;nat special)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<comp> (<reference> special subject) (:! <outputT> valueG)) + (case> (#e;Success valueT) + (<comp> (<reference> special subject) (:! <outputT> valueT)) _ false)))] diff --git a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux b/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux index 91b20d3d4..35453c44b 100644 --- a/new-luxc/test/test/luxc/generator/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux @@ -17,11 +17,11 @@ [host] test) (luxc [";L" host] - (lang ["ls" synthesis]) - (generator [";G" expression] - ["@;" eval] - ["@;" runtime] - ["@;" common])) + (lang ["ls" synthesis] + (translation [";T" expression] + ["@;" eval] + ["@;" runtime] + ["@;" common]))) (test/luxc common)) (context: "Conversions [Part 1]" @@ -32,11 +32,11 @@ (with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2>) (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))] + [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <cast> valueG)) + (case> (#e;Success valueT) + (<test> <sample> (:! <cast> valueT)) (#e;Error error) false)))] @@ -63,11 +63,11 @@ (~~ (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))] + [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <cast> valueG)) + (case> (#e;Success valueT) + (<test> <sample> (:! <cast> valueT)) (#e;Error error) false)))] @@ -89,11 +89,11 @@ (~~ (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))] + [sampleI (expressionT;generate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (<test> <sample> (:! <cast> valueG)) + (case> (#e;Success valueT) + (<test> <sample> (:! <cast> valueT)) (#e;Error error) false)))] @@ -127,14 +127,14 @@ (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<post> ((~ (code;text <procedure>)) + [sampleI (expressionT;generate (` (<post> ((~ (code;text <procedure>)) (<pre> (~ (<tag> subject))) (<pre> (~ (<tag> param)))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) + (case> (#e;Success valueT) (<test> (<reference> param subject) - (:! <type> valueG)) + (:! <type> valueT)) (#e;Error error) false)))] @@ -165,14 +165,14 @@ (~~ (do-template [<procedure> <reference>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<post> ((~ (code;text <procedure>)) + [sampleI (expressionT;generate (` (<post> ((~ (code;text <procedure>)) (<convert> (~ (code;nat subject))) (<convert> (~ (code;nat param)))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) + (case> (#e;Success valueT) (n.= (<reference> param subject) - (:! Nat valueG)) + (:! Nat valueT)) (#e;Error error) false)))] @@ -198,14 +198,14 @@ (~~ (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` (<post> ((~ (code;text <procedure>)) + [sampleI (expressionT;generate (` (<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 valueG) + (case> (#e;Success valueT) (<test> (<reference> shift (<pre-subject> subject)) - (:! <type> valueG)) + (:! <type> valueT)) (#e;Error error) false)))] @@ -229,14 +229,14 @@ (with-expansions [<tests> (do-template [<procedure> <reference>] [(test <procedure> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ((~ (code;text <procedure>)) + [sampleI (expressionT;generate (` ((~ (code;text <procedure>)) (<pre> (~ (<tag> subject))) (<pre> (~ (<tag> param))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) + (case> (#e;Success valueT) (bool/= (<reference> param subject) - (:! Bool valueG)) + (:! Bool valueT)) (#e;Error error) false)))] @@ -283,7 +283,7 @@ (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (|> (jvm//array//new +0 <class> size) + [sampleI (expressionT;generate (|> (jvm//array//new +0 <class> size) (jvm//array//write <class> idx <input>) (jvm//array//read <class> idx) (~) @@ -332,7 +332,7 @@ (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (|> (jvm//array//new +0 <class> size) + [sampleI (expressionT;generate (|> (jvm//array//new +0 <class> size) (jvm//array//write <class> idx <input>) (jvm//array//read <class> idx) (~) @@ -340,8 +340,8 @@ (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (<test> <value> (:! <type> outputG)) + (case> (#e;Success outputT) + (<test> <value> (:! <type> outputT)) (#e;Error error) false)))] @@ -360,25 +360,25 @@ [#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 (expressionG;generate (|> ("jvm array new" +1 "java.lang.Double" (~ (code;nat size))) + 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))) (`)))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (f.= valueD (:! Frac outputG)) + (case> (#e;Success outputT) + (f.= valueD (:! Frac outputT)) (#e;Error error) false))) (test "jvm array length" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code;nat size))))))] + [sampleI (expressionT;generate (` ("jvm array length" ("jvm array new" +0 "java.lang.Object" (~ (code;nat size))))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (n.= size (:! Nat outputG)) + (case> (#e;Success outputT) + (n.= size (:! Nat outputT)) (#e;Error error) false))) @@ -424,70 +424,70 @@ ($_ seq (test "jvm object null" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm object null?" ("jvm object null"))))] + [sampleI (expressionT;generate (` ("jvm object null?" ("jvm object null"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (:! Bool outputG) + (case> (#e;Success outputT) + (:! Bool outputT) (#e;Error error) false))) (test "jvm object null?" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm object null?" (~ (code;int sample)))))] + [sampleI (expressionT;generate (` ("jvm object null?" (~ (code;int sample)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (not (:! Bool outputG)) + (case> (#e;Success outputT) + (not (:! Bool outputT)) (#e;Error error) false))) (test "jvm object synchronized" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm object synchronized" (~ (code;int monitor)) (~ (code;int sample)))))] + [sampleI (expressionT;generate (` ("jvm object synchronized" (~ (code;int monitor)) (~ (code;int sample)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (i.= sample (:! Int outputG)) + (case> (#e;Success outputT) + (i.= sample (:! Int outputT)) (#e;Error error) false))) (test "jvm object throw" (|> (do meta;Monad<Meta> [_ @runtime;generate - sampleI (expressionG;generate (` ("lux try" ("lux function" +1 [] + sampleI (expressionT;generate (` ("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 outputG) - (case (:! (e;Error Top) outputG) + (case> (#e;Success outputT) + (case (:! (e;Error Top) outputT) (#e;Error error) (text;contains? exception-message error) - (#e;Success outputG) + (#e;Success outputT) false) (#e;Error error) false))) (test "jvm object class" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm object class" (~ (code;text class)))))] + [sampleI (expressionT;generate (` ("jvm object class" (~ (code;text class)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (|> outputG (:! Class) (Class.getName []) (text/= class)) + (case> (#e;Success outputT) + (|> outputT (:! Class) (Class.getName []) (text/= class)) (#e;Error error) false))) (test "jvm object instance?" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm object instance?" (~ (code;text instance-class)) (~ instance))))] + [sampleI (expressionT;generate (` ("jvm object instance?" (~ (code;text instance-class)) (~ instance))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (:! Bool outputG) + (case> (#e;Success outputT) + (:! Bool outputT) (#e;Error error) false))) @@ -513,44 +513,44 @@ ($_ seq (test "jvm member static get" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm convert int-to-long" ("jvm member static get" "java.util.GregorianCalendar" "AD" "int"))))] + [sampleI (expressionT;generate (` ("jvm convert int-to-long" ("jvm member static get" "java.util.GregorianCalendar" "AD" "int"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (i.= GregorianCalendar.AD (:! Int outputG)) + (case> (#e;Success outputT) + (i.= GregorianCalendar.AD (:! Int outputT)) (#e;Error error) false))) (test "jvm member static put" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member static put" "java.awt.datatransfer.DataFlavor" "allHtmlFlavor" "java.awt.datatransfer.DataFlavor" + [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"))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (is hostL;unit (:! Text outputG)) + (case> (#e;Success outputT) + (is hostL;unit (:! Text outputT)) (#e;Error error) false))) (test "jvm member virtual get" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))] + [sampleI (expressionT;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" (~ value-memberS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (text/= sample-string (:! Text outputG)) + (case> (#e;Success outputT) + (text/= sample-string (:! Text outputT)) (#e;Error error) false))) (test "jvm member virtual put" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member virtual get" "org.omg.CORBA.ValueMember" "name" "java.lang.String" + [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)))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (text/= other-sample-string (:! Text outputG)) + (case> (#e;Success outputT) + (text/= other-sample-string (:! Text outputT)) (#e;Error error) false))) @@ -571,43 +571,43 @@ ($_ seq (test "jvm member invoke static" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member invoke static" "java.lang.Long" "decode" "java.lang.Long" (~ coded-intS))))] + [sampleI (expressionT;generate (` ("jvm member invoke static" "java.lang.Long" "decode" "java.lang.Long" (~ coded-intS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (i.= sample (:! Int outputG)) + (case> (#e;Success outputT) + (i.= sample (:! Int outputT)) (#e;Error error) false))) (test "jvm member invoke virtual" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member invoke virtual" "java.lang.Object" "equals" "boolean" + [sampleI (expressionT;generate (` ("jvm member invoke virtual" "java.lang.Object" "equals" "boolean" (~ (code;int sample)) (~ object-longS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (:! Bool outputG) + (case> (#e;Success outputT) + (:! Bool outputT) (#e;Error error) false))) (test "jvm member invoke interface" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (` ("jvm member invoke interface" "java.util.Collection" "add" "boolean" + [sampleI (expressionT;generate (` ("jvm member invoke interface" "java.util.Collection" "add" "boolean" (~ array-listS) (~ object-longS))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (:! Bool outputG) + (case> (#e;Success outputT) + (:! Bool outputT) (#e;Error error) false))) (test "jvm member invoke constructor" (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate array-listS)] + [sampleI (expressionT;generate array-listS)] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (host;instance? ArrayList (:! Object outputG)) + (case> (#e;Success outputT) + (host;instance? ArrayList (:! Object outputT)) (#e;Error error) false))) diff --git a/new-luxc/test/test/luxc/generator/reference.lux b/new-luxc/test/test/luxc/lang/translation/reference.lux index dd522839b..0bc2bb325 100644 --- a/new-luxc/test/test/luxc/generator/reference.lux +++ b/new-luxc/test/test/luxc/lang/translation/reference.lux @@ -11,28 +11,28 @@ test) (luxc (host ["$" jvm] (jvm ["$i" inst])) - (lang ["ls" synthesis]) - ["_;" module] - (generator [";G" statement] - [";G" eval] - [";G" expression] - [";G" case] - [";G" runtime])) + (lang ["ls" synthesis] + (translation [";T" statement] + [";T" eval] + [";T" expression] + [";T" case] + [";T" runtime])) + ["_;" module]) (test/luxc common)) -(def: nilI $;Inst runtimeG;noneI) +(def: nilI $;Inst runtimeT;noneI) (def: cursorI $;Inst (|>. ($i;int 3) - ($i;array runtimeG;$Tuple) + ($i;array runtimeT;$Tuple) $i;DUP ($i;int 0) ($i;string "") $i;AASTORE $i;DUP ($i;int 1) ($i;long 0) ($i;wrap #$;Long) $i;AASTORE $i;DUP ($i;int 2) ($i;long 0) ($i;wrap #$;Long) $i;AASTORE)) (def: empty-metaI (|>. ($i;int 2) - ($i;array runtimeG;$Tuple) + ($i;array runtimeT;$Tuple) $i;DUP ($i;int 0) cursorI $i;AASTORE $i;DUP ($i;int 1) nilI $i;AASTORE)) @@ -47,12 +47,12 @@ (test "Can refer to definitions." (|> (do meta;Monad<Meta> [_ (_module;with-module +0 module-name - (statementG;generate-def def-name Int valueI empty-metaI (' {}))) - sampleI (expressionG;generate (code;symbol [module-name def-name]))] - (evalG;eval sampleI)) + (statementT;generate-def def-name Int valueI empty-metaI (' {}))) + sampleI (expressionT;generate (code;symbol [module-name def-name]))] + (evalT;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (i.= def-value (:! Int valueG)) + (case> (#e;Success valueT) + (i.= def-value (:! Int valueT)) (#e;Error error) false))) @@ -66,14 +66,14 @@ ($_ seq (test "Can refer to local variables/registers." (|> (do meta;Monad<Meta> - [sampleI (caseG;generate-let expressionG;generate + [sampleI (caseT;generate-let expressionT;generate register (code;int value) (` ((~ (code;int (nat-to-int register))))))] - (evalG;eval sampleI)) + (evalT;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success outputG) - (i.= value (:! Int outputG)) + (case> (#e;Success outputT) + (i.= value (:! Int outputT)) (#e;Error error) false))) diff --git a/new-luxc/test/test/luxc/generator/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux index 7c342dbc4..a8f74ec6a 100644 --- a/new-luxc/test/test/luxc/generator/structure.lux +++ b/new-luxc/test/test/luxc/lang/translation/structure.lux @@ -16,11 +16,11 @@ [host] test) (luxc [";L" host] - (lang ["ls" synthesis]) - (generator [";G" expression] - ["@;" eval] - ["@;" runtime] - ["@;" common])) + (lang ["ls" synthesis] + (translation [";T" expression] + ["@;" eval] + ["@;" runtime] + ["@;" common]))) (test/luxc common)) (host;import java.lang.Integer) @@ -67,13 +67,13 @@ members (r;list size gen-primitive)] (test "Can generate tuple." (|> (do meta;Monad<Meta> - [sampleI (expressionG;generate (code;tuple members))] + [sampleI (expressionT;generate (code;tuple members))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (let [valueG (:! (Array Top) valueG)] - (and (n.= size (array;size valueG)) - (list;every? corresponds? (list;zip2 members (array;to-list valueG))))) + (case> (#e;Success valueT) + (let [valueT (:! (Array Top) valueT)] + (and (n.= size (array;size valueT)) + (list;every? corresponds? (list;zip2 members (array;to-list valueT))))) _ false)))))) @@ -88,15 +88,15 @@ (test "Can generate variant." (|> (do meta;Monad<Meta> [runtime-bytecode @runtime;generate - sampleI (expressionG;generate (` ((~ (code;nat tag)) (~ (code;bool last?)) (~ member))))] + sampleI (expressionT;generate (` ((~ (code;nat tag)) (~ (code;bool last?)) (~ member))))] (@eval;eval sampleI)) (meta;run (init-compiler [])) - (case> (#e;Success valueG) - (let [valueG (:! (Array Top) valueG)] - (and (n.= +3 (array;size valueG)) - (let [_tag (:! Integer (maybe;assume (array;read +0 valueG))) - _last? (array;read +1 valueG) - _value (:! Top (maybe;assume (array;read +2 valueG)))] + (case> (#e;Success valueT) + (let [valueT (:! (Array Top) valueT)] + (and (n.= +3 (array;size valueT)) + (let [_tag (:! Integer (maybe;assume (array;read +0 valueT))) + _last? (array;read +1 valueT) + _value (:! Top (maybe;assume (array;read +2 valueT)))] (and (n.= tag (|> _tag host;i2l int-to-nat)) (case _last? (#;Some _last?') diff --git a/new-luxc/test/tests.lux b/new-luxc/test/tests.lux index 5ec79d1e5..88d89ad90 100644 --- a/new-luxc/test/tests.lux +++ b/new-luxc/test/tests.lux @@ -19,14 +19,14 @@ (case ["_;S" special]) ["_;S" function] ["_;S" procedure] - ["_;S" loop])) - (generator ["_;G" primitive] - ["_;G" structure] - ["_;G" case] - ["_;G" function] - ["_;G" reference] - (procedure ["_;G" common] - ["_;G" host])) + ["_;S" loop]) + (translation ["_;T" primitive] + ["_;T" structure] + ["_;T" case] + ["_;T" function] + ["_;T" reference] + (procedure ["_;T" common] + ["_;T" host]))) ))) (program: args |