diff options
Diffstat (limited to '')
17 files changed, 76 insertions, 70 deletions
| diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 914e31893..5ec4b1259 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 (lang ["&." host] -              [".L" translation]))) +              [".L" init])))  (def: #export (init-compiler _)    (-> Top Compiler) -  (translationL.init-compiler (io.run &host.init-host))) +  (initL.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 41b2dfaa0..382ad87e2 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 @@ -22,10 +22,9 @@                ["&." module]                ["~" analysis]                (analysis [".A" expression] -                        ["@." common] -                        ["@" procedure] -                        (procedure ["@." host])) -              (translation ["@." runtime]) +                        ["@." common]) +              (translation (jvm ["@." runtime])) +              (extension (analysis ["@." host]))                [".L" eval]))    (/// common)    (test/luxc common)) @@ -37,7 +36,8 @@             [runtime-bytecode @runtime.translate]             (&.with-scope               (&.with-type output-type -               (@.analyse-procedure analyse evalL.eval procedure params)))) +               ((expressionA.analyser evalL.eval) +                (` ((~ (code.text procedure)) (~+ params)))))))           (&.with-current-module "")           (macro.run (init-compiler []))           (case> (#e.Success _) diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index 993cacbdf..4de75b989 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -22,7 +22,7 @@                (analysis [".A" expression]                          ["@" type]                          ["@." common]) -              (translation ["@." runtime]) +              (translation (jvm ["@." runtime]))                [eval]))    (// common)    (test/luxc common)) diff --git a/new-luxc/test/test/luxc/lang/synthesis/case/special.lux b/new-luxc/test/test/luxc/lang/synthesis/case/special.lux index 4e00163ae..398f98a57 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/case/special.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/case/special.lux @@ -9,6 +9,7 @@    (luxc (lang ["la" analysis]                ["ls" synthesis]                (synthesis [".S" expression]) +              [".L" extension]                [".L" variable #+ Variable]))    (/// common)) @@ -21,7 +22,8 @@                           {("lux case bind" (~ (code.nat temp)))                            (~ (la.var (variableL.local temp)))}))]]          (test "Dummy variables created to mask expressions get eliminated during synthesis." -              (|> (expressionS.synthesize maskA) +              (|> (expressionS.synthesize extensionL.no-syntheses +                                          maskA)                    (corresponds? maskedA))))))  (context: "Let expressions." @@ -34,7 +36,8 @@                          {("lux case bind" (~ (code.nat registerA)))                           (~ outputA)}))]]          (test "Can detect and reify simple 'let' expressions." -              (|> (expressionS.synthesize letA) +              (|> (expressionS.synthesize extensionL.no-syntheses +                                          letA)                    (case> (^ [_ (#.Form (list [_ (#.Text "lux let")] [_ (#.Nat registerS)] inputS outputS))])                           (and (n/= registerA registerS)                                (corresponds? inputA inputS) @@ -58,7 +61,8 @@                           {false (~ elseA)                            true (~ thenA)})))]]          (test "Can detect and reify simple 'if' expressions." -              (|> (expressionS.synthesize ifA) +              (|> (expressionS.synthesize extensionL.no-syntheses +                                          ifA)                    (case> (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))])                           (and (corresponds? inputA inputS)                                (corresponds? thenA thenS) diff --git a/new-luxc/test/test/luxc/lang/synthesis/function.lux b/new-luxc/test/test/luxc/lang/synthesis/function.lux index 52a9d78db..bb3aa9204 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/function.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/function.lux @@ -16,6 +16,7 @@    (luxc (lang ["la" analysis]                ["ls" synthesis]                (synthesis [".S" expression]) +              [".L" extension]                [".L" variable #+ Variable]))    (// common)) @@ -101,7 +102,7 @@           [args3 prediction3 function3] gen-function//local]          ($_ seq              (test "Nested functions will get folded together." -                  (|> (expressionS.synthesize function1) +                  (|> (expressionS.synthesize extensionL.no-syntheses function1)                        (case> (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat args)] [_ (#.Tuple captured)] output))])                               (and (n/= args1 args)                                    (corresponds? prediction1 output)) @@ -109,7 +110,7 @@                               _                               (n/= +0 args1))))              (test "Folded functions provide direct access to captured variables." -                  (|> (expressionS.synthesize function2) +                  (|> (expressionS.synthesize extensionL.no-syntheses function2)                        (case> (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat args)] [_ (#.Tuple captured)]                                                   [_ (#.Form (list [_ (#.Int output)]))]))])                               (and (n/= args2 args) @@ -118,7 +119,7 @@                               _                               false)))              (test "Folded functions properly offset local variables." -                  (|> (expressionS.synthesize function3) +                  (|> (expressionS.synthesize extensionL.no-syntheses function3)                        (case> (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat args)] [_ (#.Tuple captured)]                                                   [_ (#.Form (list [_ (#.Int output)]))]))])                               (and (n/= args3 args) @@ -136,7 +137,7 @@           argsA (r.list num-args gen-primitive)]          ($_ seq              (test "Can synthesize function application." -                  (|> (expressionS.synthesize (la.apply argsA funcA)) +                  (|> (expressionS.synthesize extensionL.no-syntheses (la.apply argsA funcA))                        (case> (^ [_ (#.Form (list& [_ (#.Text "lux call")] funcS argsS))])                               (and (corresponds? funcA funcS)                                    (list.every? (product.uncurry corresponds?) @@ -145,6 +146,6 @@                               _                               false)))              (test "Function application on no arguments just synthesizes to the function itself." -                  (|> (expressionS.synthesize (la.apply (list) funcA)) +                  (|> (expressionS.synthesize extensionL.no-syntheses (la.apply (list) funcA))                        (corresponds? funcA)))              )))) diff --git a/new-luxc/test/test/luxc/lang/synthesis/loop.lux b/new-luxc/test/test/luxc/lang/synthesis/loop.lux index 805c66190..5d2db50a8 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/loop.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/loop.lux @@ -13,7 +13,8 @@    (luxc (lang ["la" analysis]                ["ls" synthesis]                (synthesis [".S" expression] -                         [".S" loop]))) +                         [".S" loop]) +              [".L" extension]))    (// common))  (def: (does-recursion? arity exprS) @@ -129,7 +130,8 @@          [[prediction arity analysis] gen-recursion]          ($_ seq              (test "Can accurately identify (and then reify) tail recursion." -                  (case (expressionS.synthesize analysis) +                  (case (expressionS.synthesize extensionL.no-syntheses +                                                analysis)                      (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat _arity)] [_ (#.Tuple _env)] _body))])                      (|> _body                          (does-recursion? arity) @@ -145,7 +147,8 @@          [[prediction arity analysis] gen-recursion]          ($_ seq              (test "Can reify loops." -                  (case (expressionS.synthesize (la.apply (list.repeat arity (' [])) analysis)) +                  (case (expressionS.synthesize extensionL.no-syntheses +                                                (la.apply (list.repeat arity (' [])) analysis))                      (^ [_ (#.Form (list [_ (#.Text "lux loop")] [_ (#.Nat in_register)] [_ (#.Tuple _inits)] _body))])                      (and (n/= arity (list.size _inits))                           (not (loopS.contains-self-reference? _body))) diff --git a/new-luxc/test/test/luxc/lang/synthesis/primitive.lux b/new-luxc/test/test/luxc/lang/synthesis/primitive.lux index 157a9c1c3..57064afd9 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/primitive.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/primitive.lux @@ -9,6 +9,7 @@         test)    (luxc (lang ["la" analysis]                ["ls" synthesis] +              [".L" extension]                (synthesis [".S" expression]))))  (context: "Primitives" @@ -22,7 +23,7 @@           %text% (r.text +5)]          (`` ($_ seq                  (test (format "Can synthesize unit.") -                      (|> (expressionS.synthesize (' [])) +                      (|> (expressionS.synthesize extensionL.no-syntheses (' []))                            (case> (^code [])                                   true @@ -30,7 +31,7 @@                                   false)))                  (~~ (do-template [<desc> <analysis> <synthesis> <sample>]                        [(test (format "Can synthesize " <desc> ".") -                             (|> (expressionS.synthesize (<analysis> <sample>)) +                             (|> (expressionS.synthesize extensionL.no-syntheses (<analysis> <sample>))                                   (case> [_ (<synthesis> value)]                                          (is <sample> value) diff --git a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux b/new-luxc/test/test/luxc/lang/synthesis/procedure.lux index 7b8923248..9648e5add 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/procedure.lux @@ -10,7 +10,8 @@         test)    (luxc (lang ["la" analysis]                ["ls" synthesis] -              (synthesis [".S" expression]))) +              (synthesis [".S" expression]) +              [".L" extension]))    (// common))  (context: "Procedures" @@ -21,7 +22,8 @@           argsA (r.list num-args gen-primitive)]          ($_ seq              (test "Can synthesize procedure calls." -                  (|> (expressionS.synthesize (la.procedure nameA argsA)) +                  (|> (expressionS.synthesize extensionL.no-syntheses +                                              (la.procedure nameA argsA))                        (case> (^ [_ (#.Form (list& [_ (#.Text procedure)] argsS))])                               (and (text/= nameA procedure)                                    (list.every? (product.uncurry corresponds?) diff --git a/new-luxc/test/test/luxc/lang/synthesis/structure.lux b/new-luxc/test/test/luxc/lang/synthesis/structure.lux index e401149ec..46c9bf2a1 100644 --- a/new-luxc/test/test/luxc/lang/synthesis/structure.lux +++ b/new-luxc/test/test/luxc/lang/synthesis/structure.lux @@ -10,7 +10,8 @@         test)    (luxc (lang ["la" analysis]                ["ls" synthesis] -              (synthesis [".S" expression]))) +              (synthesis [".S" expression]) +              [".L" extension]))    (// common))  (context: "Variants" @@ -21,7 +22,7 @@           memberA gen-primitive]          ($_ seq              (test "Can synthesize variants." -                  (|> (expressionS.synthesize (la.sum tagA size +0 memberA)) +                  (|> (expressionS.synthesize extensionL.no-syntheses (la.sum tagA size +0 memberA))                        (case> (^ [_ (#.Form (list [_ (#.Nat tagS)] [_ (#.Bool last?S)] memberS))])                               (and (n/= tagA tagS)                                    (B/= (n/= (n/dec size) tagA) @@ -39,7 +40,7 @@           membersA (r.list size gen-primitive)]          ($_ seq              (test "Can synthesize tuple." -                  (|> (expressionS.synthesize (la.product membersA)) +                  (|> (expressionS.synthesize extensionL.no-syntheses (la.product membersA))                        (case> [_ (#.Tuple membersS)]                               (and (n/= size (list.size membersS))                                    (list.every? (product.uncurry corresponds?) (list.zip2 membersA membersS))) diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/jvm/case.lux index 5b3972835..91071be6c 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/case.lux @@ -12,11 +12,11 @@         test)    (luxc [lang]          (lang ["ls" synthesis] -              (translation ["@" case] -                           [".T" expression] -                           ["@." eval] -                           ["@." runtime] -                           ["@." common]))) +              (translation (jvm ["@" case] +                                [".T" expression] +                                ["@." eval] +                                ["@." runtime] +                                ["@." common]))))    (test/luxc common))  (def: struct-limit Nat +10) diff --git a/new-luxc/test/test/luxc/lang/translation/function.lux b/new-luxc/test/test/luxc/lang/translation/jvm/function.lux index 7a87e71a1..d9ee7ac71 100644 --- a/new-luxc/test/test/luxc/lang/translation/function.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/function.lux @@ -15,10 +15,10 @@         test)    (luxc [lang]          (lang ["ls" synthesis] -              (translation [".T" expression] -                           ["@." eval] -                           ["@." runtime] -                           ["@." common]))) +              (translation (jvm [".T" expression] +                                ["@." eval] +                                ["@." runtime] +                                ["@." common]))))    (test/luxc common))  (def: arity-limit Nat +10) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/jvm/primitive.lux index d6e316036..9d51490e2 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/primitive.lux @@ -14,10 +14,10 @@    (luxc [lang]          (lang [".L" host]                ["ls" synthesis] -              (translation [".T" expression] -                           ["@." runtime] -                           ["@." eval] -                           ["@." common]))) +              (translation (jvm [".T" expression] +                                ["@." runtime] +                                ["@." eval] +                                ["@." common]))))    (test/luxc common))  (context: "Primitives." diff --git a/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm/procedure/common.jvm.lux index 96cf8b01e..8e4fd362f 100644 --- a/new-luxc/test/test/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -18,10 +18,10 @@         test)    (luxc [lang]          (lang ["ls" synthesis] -              (translation [".T" expression] -                           ["@." eval] -                           ["@." runtime] -                           ["@." common]))) +              (translation (jvm [".T" expression] +                                ["@." eval] +                                ["@." runtime] +                                ["@." common]))))    (test/luxc common))  (context: "Bit procedures" diff --git a/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm/procedure/host.jvm.lux index 4af912b2a..a8e53e79e 100644 --- a/new-luxc/test/test/luxc/lang/translation/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/procedure/host.jvm.lux @@ -19,10 +19,10 @@    (luxc [lang]          (lang [".L" host]                ["ls" synthesis] -              (translation [".T" expression] -                           ["@." eval] -                           ["@." runtime] -                           ["@." common]))) +              (translation (jvm [".T" expression] +                                ["@." eval] +                                ["@." runtime] +                                ["@." common]))))    (test/luxc common))  (context: "Conversions [Part 1]" diff --git a/new-luxc/test/test/luxc/lang/translation/reference.lux b/new-luxc/test/test/luxc/lang/translation/jvm/reference.lux index bcdef1a8b..ddbefd8d9 100644 --- a/new-luxc/test/test/luxc/lang/translation/reference.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/reference.lux @@ -14,11 +14,11 @@                (host ["$" jvm]                      (jvm ["$i" inst]))                ["ls" synthesis] -              (translation [".T" statement] -                           [".T" eval] -                           [".T" expression] -                           [".T" case] -                           [".T" runtime]))) +              (translation (jvm [".T" statement] +                                [".T" eval] +                                [".T" expression] +                                [".T" case] +                                [".T" runtime]))))    (test/luxc common))  (def: nilI $.Inst runtimeT.noneI) @@ -31,12 +31,6 @@         $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 runtimeT.$Tuple) -       $i.DUP ($i.int 0) cursorI $i.AASTORE -       $i.DUP ($i.int 1) nilI $i.AASTORE)) -  (context: "Definitions."    (<| (times +100)        (do @ @@ -48,7 +42,7 @@              (test "Can refer to definitions."                    (|> (do macro.Monad<Meta>                          [_ (_module.with-module +0 module-name -                             (statementT.translate-def def-name Int valueI empty-metaI (' {}))) +                             (statementT.translate-def def-name Int valueI (' {})))                           sampleI (expressionT.translate (code.symbol [module-name def-name]))]                          (evalT.eval sampleI))                        (lang.with-current-module "") diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/jvm/structure.lux index 078079b6b..2fc377bd6 100644 --- a/new-luxc/test/test/luxc/lang/translation/structure.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm/structure.lux @@ -18,10 +18,10 @@    (luxc [lang]          (lang [".L" host]                ["ls" synthesis] -              (translation [".T" expression] -                           ["@." eval] -                           ["@." runtime] -                           ["@." common]))) +              (translation (jvm [".T" expression] +                                ["@." eval] +                                ["@." runtime] +                                ["@." common]))))    (test/luxc common))  (host.import java/lang/Integer) diff --git a/new-luxc/test/tests.lux b/new-luxc/test/tests.lux index 98043260b..ce15be88f 100644 --- a/new-luxc/test/tests.lux +++ b/new-luxc/test/tests.lux @@ -19,13 +19,13 @@                                 ["_.S" function]                                 ["_.S" procedure]                                 ["_.S" loop]) -                    (translation ["_.T" primitive] -                                 ["_.T" structure] -                                 ["_.T" case] -                                 ["_.T" function] -                                 ["_.T" reference] -                                 (procedure ["_.T" common] -                                            ["_.T" host]))) +                    (translation (jvm ["_.T" primitive] +                                      ["_.T" structure] +                                      ["_.T" case] +                                      ["_.T" function] +                                      ["_.T" reference] +                                      (procedure ["_.T" common] +                                                 ["_.T" host]))))                )))  (program: args | 
