diff options
Diffstat (limited to 'new-luxc')
55 files changed, 342 insertions, 186 deletions
diff --git a/new-luxc/source/luxc/lang/host/common-lisp.lux b/new-luxc/source/luxc/lang/host/common-lisp.lux index 2acc52700..50a942636 100644 --- a/new-luxc/source/luxc/lang/host/common-lisp.lux +++ b/new-luxc/source/luxc/lang/host/common-lisp.lux @@ -102,7 +102,7 @@ (-> Text Expression) (|>> %t :abstraction)) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export <name> (-> Text Expression) (|>> (format <prefix>) :abstraction))] @@ -127,7 +127,7 @@ (-> Expression (List Expression) Expression) (form (#.Cons func args))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> (-> (List Expression) Expression) ($apply (..global <function>)))] @@ -156,7 +156,7 @@ (-> Expression (-> Expression Expression)) (|>> (.list) (..$apply func))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (..$apply1 (..global <scheme-name>)))] [length "length"] @@ -204,7 +204,7 @@ (.function (_ _0 _1) (..$apply func (.list _0 _1)))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (..$apply2 (..global <scheme-name>)))] [append "append"] @@ -224,7 +224,7 @@ (.function (_ _0 _1 _2) (..$apply func (.list _0 _1 _2)))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> ($apply3 (..global <scheme-name>)))] [subseq/3 "subseq"] @@ -237,7 +237,7 @@ (-> Expression Expression Expression) (concatenate/3 (..symbol "string"))) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export <lux-name> (-> (List Expression) Expression) (|>> (.list& (..global <scheme-name>)) ..form))] @@ -246,7 +246,7 @@ [and "and"] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export (<lux-name> param subject) (-> Expression Expression Expression) (..form (.list (..global <scheme-name>) subject param)))] @@ -273,7 +273,7 @@ [logxor "logxor"] ) - (do-template [<lux-name> <scheme-name>] + (template [<lux-name> <scheme-name>] [(def: #export (<lux-name> bindings body) (-> (List [SVar Expression]) Expression Expression) (..form (.list (..global <scheme-name>) @@ -342,7 +342,7 @@ handler))) handlers)))) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export (<name> conditions expression) (-> (List Text) Expression Expression) (case conditions diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index 32a24452d..71e887d4d 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -96,7 +96,7 @@ (type: #export Host (translation.Host Inst Definition)) -(do-template [<name> <base>] +(template [<name> <base>] [(type: #export <name> (<base> ..Anchor Inst Definition))] diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index db6bfe07b..f9b6e5c2d 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -154,7 +154,7 @@ ## (ClassWriter::COMPUTE_FRAMES) )) -(do-template [<name> <flag>] +(template [<name> <flag>] [(def: #export (<name> version visibility config name parameters super interfaces definitions) (-> $.Version $.Visibility $.Class-Config Text (List $.Parameter) $.Class (List $.Class) $.Def @@ -251,7 +251,7 @@ (FieldVisitor::visitEnd))] writer))) -(do-template [<name> <lux-type> <jvm-type> <prepare>] +(template [<name> <lux-type> <jvm-type> <prepare>] [(def: #export (<name> visibility config name value) (-> $.Visibility $.Field-Config Text <lux-type> $.Def) (function (_ writer) diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index 5311f39d9..36a020686 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -127,7 +127,7 @@ (-> (-> Label Inst) Inst) (action (Label::new))) -(do-template [<name> <type> <prepare>] +(template [<name> <type> <prepare>] [(def: #export (<name> value) (-> <type> Inst) (function (_ visitor) @@ -151,7 +151,7 @@ (do-to visitor (MethodVisitor::visitInsn (prefix ACONST_NULL))))) -(do-template [<name>] +(template [<name>] [(def: #export <name> Inst (function (_ visitor) @@ -212,7 +212,7 @@ [RETURN] [IRETURN] [LRETURN] [DRETURN] [ARETURN] ) -(do-template [<name>] +(template [<name>] [(def: #export (<name> register) (-> Nat Inst) (function (_ visitor) @@ -223,7 +223,7 @@ [ISTORE] [LSTORE] [ASTORE] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class field type) (-> Text Text //.Type Inst) (function (_ visitor) @@ -237,7 +237,7 @@ [GETFIELD Opcodes::GETFIELD] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class) (-> Text Inst) (function (_ visitor) @@ -265,7 +265,7 @@ #//.Double (Opcodes::T_DOUBLE) #//.Char (Opcodes::T_CHAR)))))) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: #export (<name> class method-name method-signature interface?) (-> Text Text //.Method Bit Inst) (function (_ visitor) @@ -278,7 +278,7 @@ [INVOKEINTERFACE Opcodes::INVOKEINTERFACE] ) -(do-template [<name>] +(template [<name>] [(def: #export (<name> @where) (-> //.Label Inst) (function (_ visitor) diff --git a/new-luxc/source/luxc/lang/host/jvm/type.lux b/new-luxc/source/luxc/lang/host/jvm/type.lux index 523944b44..72a1925b4 100644 --- a/new-luxc/source/luxc/lang/host/jvm/type.lux +++ b/new-luxc/source/luxc/lang/host/jvm/type.lux @@ -8,7 +8,7 @@ ["." //]) ## Types -(do-template [<name> <primitive>] +(template [<name> <primitive>] [(def: #export <name> //.Type (#//.Primitive <primitive>))] [boolean #//.Boolean] diff --git a/new-luxc/source/luxc/lang/host/lua.lux b/new-luxc/source/luxc/lang/host/lua.lux index ec2fa8928..364c05052 100644 --- a/new-luxc/source/luxc/lang/host/lua.lux +++ b/new-luxc/source/luxc/lang/host/lua.lux @@ -144,7 +144,7 @@ (text.join-with ", ")) "}")) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] @@ -162,7 +162,7 @@ [% "%"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" param " " <op> " " subject ")"))] @@ -174,7 +174,7 @@ [bit-xor "~"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux index 6ab97ee52..878bbaa18 100644 --- a/new-luxc/source/luxc/lang/host/php.lux +++ b/new-luxc/source/luxc/lang/host/php.lux @@ -56,7 +56,7 @@ (text.join-with ", ") (text.enclose ["(" ")"]))) - (do-template [<name> <reference?>] + (template [<name> <reference?>] [(def: #export <name> (-> Var Argument) (|>> [<reference?>]))] @@ -127,7 +127,7 @@ " " uses " " (block (:representation body)))))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> Computation (..apply (list) (..global <function>)))] @@ -136,7 +136,7 @@ [func-get-args/0 "func_get_args"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> values) (-> (List Expression) Computation) (..apply values (..global <function>)))] @@ -144,7 +144,7 @@ [array/* "array"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> required optionals) (-> Expression (List Expression) Computation) (..apply (list& required optionals) (..global <function>)))] @@ -162,7 +162,7 @@ (text.join-with ", ")) ")"))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0) (-> Expression Computation) (..apply (list input0) (..global <function>)))] @@ -174,7 +174,7 @@ [floatval/1 "floatval"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0 input1) (-> Expression Expression Computation) (..apply (list input0 input1) (..global <function>)))] @@ -184,7 +184,7 @@ [array-push/2 "array_push"] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> input0 input1 input2) (-> Expression Expression Expression Computation) (..apply (list input0 input1 input2) (..global <function>)))] @@ -213,7 +213,7 @@ (:representation then) " : " (:representation else)))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Computation) (computation @@ -244,7 +244,7 @@ (-> Computation Computation) (|>> :representation (format "!") :abstraction)) - (do-template [<name> <type> <constructor>] + (template [<name> <type> <constructor>] [(def: #export (<name> var value) (-> Var Expression <type>) (<constructor> (format (:representation var) " = " (:representation value))))] @@ -317,7 +317,7 @@ (format "try " (block (:representation body!)) "\n" (|> excepts (list/map catch!) (text.join-with "\n"))))) - (do-template [<name> <keyword>] + (template [<name> <keyword>] [(def: #export (<name> message) (-> Expression Statement) (statement (format <keyword> " " (:representation message))))] diff --git a/new-luxc/source/luxc/lang/host/r.lux b/new-luxc/source/luxc/lang/host/r.lux index 8cd802df9..6e4c7fb5b 100644 --- a/new-luxc/source/luxc/lang/host/r.lux +++ b/new-luxc/source/luxc/lang/host/r.lux @@ -109,7 +109,7 @@ (composite-literal "list(" ")" (.function (_ [key value]) (format key "=" (:representation value))))) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export <name> (-> (List Expression) Expression) (composite-literal (format <function> "(") ")" expression))] @@ -172,7 +172,7 @@ else (list.reverse clauses))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (self-contained @@ -203,7 +203,7 @@ (-> Text Expression) (|>> var @@)) - (do-template [<name> <func>] + (template [<name> <func>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (..apply (.list subject param) (..global <func>)))] @@ -219,7 +219,7 @@ (-> Expression Expression) (..apply (.list subject) (..global "bitwNot"))) - (do-template [<name> <op>] + (template [<name> <op>] [(def: #export <name> (-> Expression Expression) (|>> :representation (format <op>) self-contained))] @@ -271,7 +271,7 @@ (format "for (" (..name var) " in " (..expression inputs) ")" (.._block (:representation body))))) - (do-template [<name> <keyword>] + (template [<name> <keyword>] [(def: #export (<name> message) (-> Expression Expression) (..apply (.list message) (..global <keyword>)))] diff --git a/new-luxc/source/luxc/lang/host/ruby.lux b/new-luxc/source/luxc/lang/host/ruby.lux index 61e945af0..61c0f8bb5 100644 --- a/new-luxc/source/luxc/lang/host/ruby.lux +++ b/new-luxc/source/luxc/lang/host/ruby.lux @@ -179,7 +179,7 @@ (#.Some name) (format "(" name " = " proc ")")))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] @@ -197,7 +197,7 @@ [pow "**"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" param " " <op> " " subject ")"))] @@ -209,7 +209,7 @@ [bit-xor "^"] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Expression Expression Expression) (format "(" subject " " <op> " " param ")"))] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp.lux b/new-luxc/source/luxc/lang/translation/common-lisp.lux index 360a230f9..a9ea2c215 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp.lux @@ -18,7 +18,7 @@ (host ["_" common-lisp #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -162,7 +162,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux index 54b77e60d..9f918bdd5 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux @@ -32,7 +32,7 @@ (#e.Error error) (log! error))) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux index 45887cdae..437648fbb 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux @@ -21,7 +21,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux index b140a11eb..3eaa60821 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux @@ -142,7 +142,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -182,7 +182,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -192,7 +192,7 @@ [frac//max Double::MAX_VALUE _.double] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO (<op> paramO)))] @@ -206,7 +206,7 @@ [int//< _.<] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux index 6d2a491c6..def77fc35 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register SVar) (_.var (format <prefix> (%i (.int register))))) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 1f06130e4..5fa6179c7 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -206,7 +206,7 @@ Runtime (_.progn (list @@bit//logical-right-shift))) -(do-template [<name> <top-cmp>] +(template [<name> <top-cmp>] [(def: (<name> top value) (-> Expression Expression Expression) (_.and (list (|> value (_.>= (_.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux index 628edff49..e514fe28a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux @@ -21,7 +21,7 @@ (if value "TRUE" "FALSE") ($t.class "java.lang.Boolean" (list))))) -(do-template [<name> <type> <load> <wrap>] +(template [<name> <type> <load> <wrap>] [(def: #export (<name> value) (-> <type> (Operation Inst)) (let [loadI (|> value <load>)] diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 55cf8a644..faec813e9 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -118,7 +118,7 @@ #0))) ### Bits -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [maskI inputI]) Binary (|>> inputI (_.unwrap #$.Long) @@ -130,7 +130,7 @@ [bit::xor _.LXOR] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [shiftI inputI]) Binary (|>> inputI (_.unwrap #$.Long) @@ -144,7 +144,7 @@ ) ### Numbers -(do-template [<name> <const> <type>] +(template [<name> <const> <type>] [(def: (<name> _) Nullary (|>> <const> (_.wrap <type>)))] @@ -154,7 +154,7 @@ [frac::max (_.double (Double::MAX_VALUE)) #$.Double] ) -(do-template [<name> <type> <op>] +(template [<name> <type> <op>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI (_.unwrap <type>) @@ -175,8 +175,8 @@ [frac::% #$.Double _.DREM] ) -(do-template [<eq> <lt> <unwrap> <cmp>] - [(do-template [<name> <reference>] +(template [<eq> <lt> <unwrap> <cmp>] + [(template [<name> <reference>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI <unwrap> @@ -192,7 +192,7 @@ [frac::= frac::< (_.unwrap #$.Double) _.DCMPG] ) -(do-template [<name> <prepare> <transform>] +(template [<name> <prepare> <transform>] [(def: (<name> inputI) Unary (|>> inputI <prepare> <transform>))] @@ -216,7 +216,7 @@ (_.INVOKEVIRTUAL "java.lang.String" "length" (_t.method (list) (#.Some _t.int) (list)) #0) lux-intI)) -(do-template [<name> <pre-subject> <pre-param> <op> <post>] +(template [<name> <pre-subject> <pre-param> <op> <post>] [(def: (<name> [subjectI paramI]) Binary (|>> subjectI <pre-subject> @@ -237,7 +237,7 @@ lux-intI] ) -(do-template [<name> <pre-subject> <pre-param> <pre-extra> <op>] +(template [<name> <pre-subject> <pre-param> <pre-extra> <op>] [(def: (<name> [subjectI paramI extraI]) Trinary (|>> subjectI <pre-subject> diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux index 483f810e2..624af7ed8 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux @@ -25,7 +25,7 @@ ["ls" synthesis])) (// ["@" common])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -33,7 +33,7 @@ [Invalid-Syntax-For-Argument-Generation] ) -(do-template [<name> <inst>] +(template [<name> <inst>] [(def: <name> $.Inst <inst>)] @@ -43,7 +43,7 @@ [L2C (|>> _.L2I _.I2C)] ) -(do-template [<name> <unwrap> <conversion> <wrap>] +(template [<name> <unwrap> <conversion> <wrap>] [(def: (<name> inputI) @.Unary (if (is? _.NOP <conversion>) @@ -111,7 +111,7 @@ (@.install "short-to-long" (@.unary convert//short-to-long)) ))) -(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (|>> xI (_.unwrap <unwrapX>) @@ -159,7 +159,7 @@ (def: falseI (_.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class)) (def: trueI (_.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class)) -(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (<| _.with-label (function (_ @then)) @@ -180,7 +180,7 @@ [char//< _.IF_ICMPLT #$.Char #$.Char #$.Boolean] ) -(do-template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>] +(template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary (<| _.with-label (function (_ @then)) @@ -684,7 +684,7 @@ _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) -(do-template [<name> <invoke> <interface?>] +(template [<name> <invoke> <interface?>] [(def: (<name> proc translate inputs) (-> Text @.Proc) (case inputs diff --git a/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux index fe4a58b36..0a354a929 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/reference.jvm.lux @@ -19,7 +19,7 @@ ["_" inst]]]]] ["." //]) -(do-template [<name> <prefix>] +(template [<name> <prefix>] [(def: #export (<name> idx) (-> Nat Text) (|> idx %n (format <prefix>)))] diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux index e5272a3ea..e79af1048 100644 --- a/new-luxc/source/luxc/lang/translation/lua.lux +++ b/new-luxc/source/luxc/lang/translation/lua.lux @@ -18,7 +18,7 @@ (host [lua #+ Lua Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux index 18ae10e0a..17596ffa7 100644 --- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux @@ -11,7 +11,7 @@ (lang (host [lua #+ Lua Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux index 5d6b073fc..6597364bb 100644 --- a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux index 94337001e..2f1b652e3 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux @@ -135,7 +135,7 @@ (loopT.translate-recur translate inputsS)))) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -145,7 +145,7 @@ [bit//xor lua.bit-xor] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -163,7 +163,7 @@ (#static POSITIVE_INFINITY Double) (#static NEGATIVE_INFINITY Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -173,7 +173,7 @@ [frac//max Double::MAX_VALUE lua.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -185,7 +185,7 @@ [int//rem lua.%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -202,7 +202,7 @@ [text//< lua.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] @@ -220,7 +220,7 @@ (lux//try (lua.function (list) (lua.return! (lua.apply "tonumber" (list inputO)))))) -(do-template [<name> <divisor>] +(template [<name> <divisor>] [(def: (<name> inputO) Unary (lua./ <divisor> inputO))] @@ -228,7 +228,7 @@ [int//to-frac (lua.float 1.0)] ) -(do-template [<name> <transform>] +(template [<name> <transform>] [(def: (<name> inputO) Unary (|> inputO <transform>))] @@ -241,7 +241,7 @@ (|>> (list) (lua.apply "string.char"))) ## [[Text]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> Unary (|>> (list) (lua.apply <op>)))] @@ -257,7 +257,7 @@ Binary (runtimeT.text//char subjectO paramO)) -(do-template [<name> <runtime>] +(template [<name> <runtime>] [(def: (<name> [subjectO paramO extraO]) Trinary (<runtime> subjectO paramO extraO))] diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux index 2271d354a..f53f3ba05 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -(do-template [<name> <lua>] +(template [<name> <lua>] [(def: (<name> _) @.Nullary <lua>)] [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux index fac6308a0..ea3f8e604 100644 --- a/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register Expression) (format <prefix> (%i (.int register)))) diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux index db0eeced4..0a694d3e6 100644 --- a/new-luxc/source/luxc/lang/translation/php.lux +++ b/new-luxc/source/luxc/lang/translation/php.lux @@ -19,7 +19,7 @@ (host ["_" php #+ Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -159,7 +159,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <inputT> <outputT>] +(template [<name> <field> <inputT> <outputT>] [(def: (<name> code) (-> <inputT> (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux index 3bfd5578a..4c4a6c641 100644 --- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux @@ -12,7 +12,7 @@ (lang (host ["_" php #+ Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index 3d7d652bf..c49003c64 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" procedure] )) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux index f77a35292..7a44accf2 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux @@ -146,7 +146,7 @@ ## )) ## ## [[Bits]] -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -161,7 +161,7 @@ ## (|> (_.bit-shl paramO subjectO) ## runtimeT.bit//64)) -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -187,7 +187,7 @@ ## (#static MIN_VALUE Double) ## (#static MAX_VALUE Double)) -## (do-template [<name> <const> <encode>] +## (template [<name> <const> <encode>] ## [(def: (<name> _) ## Nullary ## (<encode> <const>))] @@ -197,7 +197,7 @@ ## [frac//max Double::MAX_VALUE _.float] ## ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO @@ -210,7 +210,7 @@ [int//% _.%] ) -## (do-template [<name> <op>] +## (template [<name> <op>] ## [(def: (<name> [subjectO paramO]) ## Binary ## (<op> paramO subjectO))] @@ -227,7 +227,7 @@ ## [text//< _.<] ## ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux index 833fc5e5a..2415963d1 100644 --- a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <prefix>] +(template [<register> <prefix>] [(def: #export <register> (-> Register Var) (|>> (:coerce Int) %i (format <prefix>) _.var))] @@ -27,7 +27,7 @@ (-> Name Var) (|>> //.definition-name _.var)) -(do-template [<name> <input> <converter>] +(template [<name> <input> <converter>] [(def: #export <name> (-> <input> (Meta Var)) (|>> <converter> (:: macro.Monad<Meta> wrap)))] diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index 3d5ea1775..7c4d9f444 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -239,7 +239,7 @@ ## (def: inc (|>> (_.+ (_.int 1)))) -## (do-template [<name> <top-cmp>] +## (template [<name> <top-cmp>] ## [(def: (<name> top value) ## (-> Expression Expression Expression) ## (_.and (|> value (_.>= (_.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/new-luxc/source/luxc/lang/translation/r.lux index a013bfd1c..d5a9f35fa 100644 --- a/new-luxc/source/luxc/lang/translation/r.lux +++ b/new-luxc/source/luxc/lang/translation/r.lux @@ -18,7 +18,7 @@ (host [r #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -161,7 +161,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux index d838bc332..3c41fbe63 100644 --- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux @@ -22,7 +22,7 @@ [".T" procedure]) ) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index 261e6cfb9..f806805c0 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -147,7 +147,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -157,7 +157,7 @@ [bit//xor runtimeT.bit//xor] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> (runtimeT.int64-low paramO) subjectO))] @@ -184,7 +184,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -194,7 +194,7 @@ [frac//max Double::MAX_VALUE r.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (|> subjectO (<op> paramO)))] @@ -206,7 +206,7 @@ [int//rem runtimeT.int//%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -223,7 +223,7 @@ [text//< r.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux index 087b87504..7de1c74ee 100644 --- a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register SVar) (r.var (format <prefix> (%i (.int register))))) diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index ce2265a8e..d641041d2 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -163,7 +163,7 @@ (r.named-list (list [//.int-high-field (as-integer (@@ high))] [//.int-low-field (as-integer (@@ low))]))) -(do-template [<name> <value>] +(template [<name> <value>] [(runtime: <name> (..int <value>))] @@ -597,7 +597,7 @@ @@sum//get )) -(do-template [<name> <op>] +(template [<name> <op>] [(runtime: (<name> mask input) (int//new (<op> (int64-high (@@ mask)) (int64-high (@@ input))) @@ -659,7 +659,7 @@ (def: inc (-> Expression Expression) (|>> (r.+ (r.int 1)))) -(do-template [<name> <top-cmp>] +(template [<name> <top-cmp>] [(def: (<name> top value) (-> Expression Expression Expression) (|> (|> value (r.>= (r.int 0))) diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux index 501e8e2c1..084c614ec 100644 --- a/new-luxc/source/luxc/lang/translation/ruby.lux +++ b/new-luxc/source/luxc/lang/translation/ruby.lux @@ -18,7 +18,7 @@ (host [ruby #+ Ruby Expression Statement])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux index 52a261b2a..3742ae467 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -11,7 +11,7 @@ (lang (host [ruby #+ Ruby Expression Statement]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux index 6023f3a82..3016836b9 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux @@ -21,7 +21,7 @@ [".T" case] [".T" procedure])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index 9176879b1..c60938d79 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -145,7 +145,7 @@ )) ## [[Bits]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -160,7 +160,7 @@ (ruby.bit-and "0xFFFFFFFFFFFFFFFF" (ruby.bit-shl paramO subjectO))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -186,7 +186,7 @@ (#static MIN_VALUE Double) (#static MAX_VALUE Double)) -(do-template [<name> <const> <encode>] +(template [<name> <const> <encode>] [(def: (<name> _) Nullary (<encode> <const>))] @@ -196,7 +196,7 @@ [frac//max Double::MAX_VALUE ruby.float] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (ruby.bit-and "0xFFFFFFFFFFFFFFFF" @@ -207,7 +207,7 @@ [int//mul ruby.*] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -216,7 +216,7 @@ [int//rem ruby.%] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: (<name> [subjectO paramO]) Binary (<op> paramO subjectO))] @@ -233,7 +233,7 @@ [text//< ruby.<] ) -(do-template [<name> <cmp>] +(template [<name> <cmp>] [(def: (<name> [subjectO paramO]) Binary (<cmp> paramO subjectO))] @@ -291,7 +291,7 @@ (install "decode" (unary frac//decode))))) ## [[Text]] -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> Unary (ruby.send <op> (list)))] diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux index af82491b6..2793b40e8 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/host.jvm.lux @@ -14,7 +14,7 @@ (/// [".T" runtime]) (// ["@" common])) -## (do-template [<name> <lua>] +## (template [<name> <lua>] ## [(def: (<name> _) @.Nullary <lua>)] ## [lua//nil "nil"] diff --git a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux index fb206b127..80e78951b 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/reference.jvm.lux @@ -9,7 +9,7 @@ [//] (// [".T" runtime])) -(do-template [<register> <translation> <prefix>] +(template [<register> <translation> <prefix>] [(def: #export (<register> register) (-> Register Expression) (format <prefix> (%i (.int register)))) diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux index 7d261ca04..e509cb8ca 100644 --- a/new-luxc/source/luxc/lang/translation/scheme.lux +++ b/new-luxc/source/luxc/lang/translation/scheme.lux @@ -18,7 +18,7 @@ (host [scheme #+ Expression])) [".C" io])) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] @@ -164,7 +164,7 @@ (function (_ compiler) (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) -(do-template [<name> <field> <outputT>] +(template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux index ae4a4151a..db9b25129 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -13,7 +13,7 @@ (lang (host [scheme #+ Expression]))) [//]) -(do-template [<name>] +(template [<name>] [(exception: #export (<name> {message Text}) message)] diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index f694d81bd..a68e2824c 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -52,7 +52,7 @@ (type: #export Runner (-> Synthesis (Error Any))) (type: #export Definer (-> Name Synthesis (Error Any))) -(do-template [<name> <host>] +(template [<name> <host>] [(def: #export <name> (IO State) (:: io.Monad<IO> map translation.state <host>))] diff --git a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux index 9d09216b8..f9905c8bc 100644 --- a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux +++ b/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux @@ -31,7 +31,7 @@ [/// ["_." primitive]]) -(do-template [<name> <success> <failure>] +(template [<name> <success> <failure>] [(def: (<name> procedure params output-type) (-> Text (List Code) Type Bit) (|> (do Monad<Meta> @@ -52,7 +52,7 @@ [failure #0 #1] ) -(do-template [<name> <success> <failure>] +(template [<name> <success> <failure>] [(def: (<name> syntax output-type) (-> Code Type Bit) (|> (do Monad<Meta> @@ -74,7 +74,7 @@ ) (context: "Conversions [double + float]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -92,7 +92,7 @@ ))) (context: "Conversions [int]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -110,7 +110,7 @@ ))) (context: "Conversions [long]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -127,7 +127,7 @@ ))) (context: "Conversions [char + byte + short]." - (with-expansions [<conversions> (do-template [<procedure> <from> <to>] + (with-expansions [<conversions> (template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") @@ -144,9 +144,9 @@ <conversions> ))) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Arithmetic " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -164,7 +164,7 @@ ))) (context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -179,7 +179,7 @@ ))) (context: (format "Bitwise " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -202,9 +202,9 @@ ["long" "java.lang.Long" hostAE.Long] ) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Arithmetic " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -222,7 +222,7 @@ ))) (context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) @@ -241,9 +241,9 @@ ["double" "java.lang.Double" hostAE.Double] ) -(do-template [<domain> <boxed> <type>] +(template [<domain> <boxed> <type>] [(context: (format "Order " "[" <domain> "].") - (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] + (with-expansions [<instructions> (template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> (list (' ("lux coerce" (+0 <subject> (+0)) [])) diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index 707565fca..dc1a0fea9 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -29,7 +29,7 @@ (def: check (r.Random [Code Type Code]) - (with-expansions [<triples> (do-template [<random> <type> <code>] + (with-expansions [<triples> (template [<random> <type> <code>] [(do r.Monad<Random> [value <random>] (wrap [(` <type>) diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux index 801d9f1d7..0cee2818a 100644 --- a/new-luxc/test/test/luxc/lang/translation/case.lux +++ b/new-luxc/test/test/luxc/lang/translation/case.lux @@ -4,16 +4,22 @@ [monad (#+ do)] pipe] [data + ["." error] + [text ("text/." Equivalence<Text>) + format] [collection - ["." list]]] + ["." list ("list/." Functor<List> Fold<List>)]]] [math ["r" random (#+ Random)]] [compiler [default ["." reference] - [phase + ["." phase ["." analysis] - ["." synthesis (#+ Path Synthesis)]]]] + ["." synthesis (#+ Path Synthesis) + ["." case] + ["." expression]] + ["." extension/synthesis]]]] test] [test [luxc @@ -39,7 +45,7 @@ [value r.i64] (wrap [(synthesis.i64 value) synthesis.path/pop])) - (~~ (do-template [<gen> <synth> <path>] + (~~ (template [<gen> <synth> <path>] [(do r.Monad<Random> [value <gen>] (wrap [(<synth> value) @@ -58,10 +64,11 @@ (list.concat (list (list.repeat idx unitS) (list subS) (list.repeat (|> size dec (n/- idx)) unitS)))) - caseP (synthesis.path/seq [(if (tail? size idx) - (synthesis.member/right idx) - (synthesis.member/left idx)) - subP])]] + caseP ($_ synthesis.path/seq + (if (tail? size idx) + (synthesis.member/right idx) + (synthesis.member/left idx)) + subP)]] (wrap [caseS caseP])) (do r.Monad<Random> [size ..size @@ -72,11 +79,11 @@ {#analysis.lefts idx #analysis.right? right? #analysis.value subS}) - caseP (synthesis.path/seq - [(if right? - (synthesis.side/right idx) - (synthesis.side/left idx)) - subP])]] + caseP ($_ synthesis.path/seq + (if right? + (synthesis.side/right idx) + (synthesis.side/left idx)) + subP)]] (wrap [caseS caseP])) )))) @@ -111,17 +118,166 @@ (test "Case." (|> (run (synthesis.branch/case [inputS - (synthesis.path/alt [(synthesis.path/seq [pathS - (synthesis.path/then (synthesis.f64 on-success))]) - (synthesis.path/then (synthesis.f64 on-failure))])])) + ($_ synthesis.path/alt + ($_ synthesis.path/seq + pathS + (synthesis.path/then (synthesis.f64 on-success))) + (synthesis.path/then (synthesis.f64 on-failure)))])) (&.check on-success))))) +(def: special-input + Synthesis + (let [_cursor_ (: Synthesis + (synthesis.tuple (list (synthesis.text "lux") + (synthesis.i64 +901) + (synthesis.i64 +13)))) + _code_ (: (-> Synthesis Synthesis) + (function (_ content) + (synthesis.tuple (list _cursor_ content)))) + _nil_ (: Synthesis + (synthesis.variant [0 #0 (synthesis.text "")])) + _cons_ (: (-> Synthesis Synthesis Synthesis) + (function (_ head tail) + (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) + _list_ (: (-> (List Synthesis) Synthesis) + (list/fold _cons_ _nil_))] + (let [__tuple__ (: (-> (List Synthesis) Synthesis) + (|>> list.reverse _list_ [9 #0] synthesis.variant _code_)) + __form__ (: (-> (List Synthesis) Synthesis) + (|>> list.reverse _list_ [8 #0] synthesis.variant _code_)) + __text__ (: (-> Text Synthesis) + (function (_ value) + (_code_ (synthesis.variant [5 #0 (synthesis.text value)])))) + __identifier__ (: (-> Name Synthesis) + (function (_ [module short]) + (_code_ (synthesis.variant [6 #0 (synthesis.tuple (list (synthesis.text module) + (synthesis.text short)))])))) + __tag__ (: (-> Name Synthesis) + (function (_ [module short]) + (_code_ (synthesis.variant [7 #0 (synthesis.tuple (list (synthesis.text module) + (synthesis.text short)))])))) + __list__ (: (-> (List Synthesis) Synthesis) + (list/fold (function (_ head tail) + (__form__ (list (__tag__ ["" "Cons"]) head tail))) + (__tag__ ["" "Nil"]))) + __apply__ (: (-> Synthesis Synthesis Synthesis) + (function (_ func arg) + (__form__ (list func arg))))] + (|> _nil_ + (_cons_ (__apply__ (__identifier__ ["" "form$"]) + (__list__ (list (__apply__ (__identifier__ ["" "tag$"]) + (__tuple__ (list (__text__ "lux") + (__text__ "Cons")))) + (__identifier__ ["" "export?-meta"]) + (__identifier__ ["" "tail"]))))) + (_cons_ (__tuple__ (list (__identifier__ ["" "tail"])))) + )))) + +(def: special-path + Path + (let [_nil_ (synthesis.path/side (#.Left 0)) + _cons_ (synthesis.path/side (#.Right 0)) + _head_ (synthesis.path/member (#.Left 0)) + _tail_ (synthesis.path/member (#.Right 0)) + _tuple_ (synthesis.path/side (#.Left 9))] + ($_ synthesis.path/alt + ($_ synthesis.path/seq + _cons_ + _head_ + _head_ (synthesis.path/bind 2) synthesis.path/pop + _tail_ _tuple_ _cons_ + _head_ (synthesis.path/bind 3) synthesis.path/pop + _tail_ (synthesis.path/bind 4) synthesis.path/pop + synthesis.path/pop synthesis.path/pop synthesis.path/pop synthesis.path/pop + _tail_ _cons_ + _head_ (synthesis.path/bind 5) synthesis.path/pop + _tail_ _nil_ + ## THEN + (synthesis.path/then (synthesis.bit #1))) + ($_ synthesis.path/seq + (synthesis.path/bind 2) + ## THEN + (synthesis.path/then (synthesis.bit #0)))))) + +(def: special-pattern + analysis.Pattern + (let [## [_ (#Tuple (#Cons arg args'))] + head (<| analysis.pattern/tuple (list (analysis.pattern/bind 2)) + analysis.pattern/variant [9 #0] + analysis.pattern/variant [0 #1] + analysis.pattern/tuple (list (analysis.pattern/bind 3) + (analysis.pattern/bind 4))) + ## (#Cons body #Nil) + tail (<| analysis.pattern/variant [0 #1] + analysis.pattern/tuple (list (analysis.pattern/bind 5)) + analysis.pattern/variant [0 #0] + (analysis.pattern/unit))] + ## (#Cons <head> <tail>) + (<| analysis.pattern/variant [0 #1] + (analysis.pattern/tuple (list head tail))))) + +(def: special-pattern-path + Path + ($_ synthesis.path/alt + (<| error.assume + (phase.run [extension/synthesis.bundle + synthesis.init]) + (case.path expression.synthesize + special-pattern) + (analysis.bit #1)) + ($_ synthesis.path/seq + (synthesis.path/bind 2) + ## THEN + (synthesis.path/then (synthesis.bit #0))))) + +(def: (special-spec run) + (-> Runner Test) + (do r.Monad<Random> + [] + ($_ seq + (test "===" + (and (text/= (synthesis.%path special-path) + (synthesis.%path special-pattern-path)) + (:: synthesis.Equivalence<Path> = special-path special-pattern-path))) + (test "CODE" + (|> (run special-input) + (case> (#error.Success output) + (exec (log! (|> output (:coerce (List Code)) (%list %code))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + (test "PATTERN-MATCHING 0" + (|> (run (synthesis.branch/case [special-input + special-path])) + (case> (#error.Success output) + (exec (log! (format "output 0 = " (%b (:coerce Bit output)))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + (test "PATTERN-MATCHING 1" + (|> (run (synthesis.branch/case [special-input + special-pattern-path])) + (case> (#error.Success output) + (exec (log! (format "output 1 = " (%b (:coerce Bit output)))) + #1) + + (#error.Error error) + (exec (log! error) + #0)))) + ))) + (def: (pattern-matching-spec run) (-> Runner Test) ($_ seq - (let-spec run) - (if-spec run) - (case-spec run))) + (special-spec run) + ## (let-spec run) + ## (if-spec run) + ## (case-spec run) + )) (context: "[JVM] Pattern-matching." (<| (times 100) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index 3005a7588..1e671aa96 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -31,7 +31,7 @@ (do r.Monad<Random> [param r.i64 subject r.i64] - (with-expansions [<binary> (do-template [<name> <reference> <param-expr>] + (with-expansions [<binary> (template [<name> <reference> <param-expr>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject) (synthesis.i64 param)))) @@ -70,7 +70,7 @@ [param (|> r.i64 (r.filter (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ seq - (~~ (do-template [<name> <type> <prepare> <comp> <subject-expr>] + (~~ (template [<name> <type> <prepare> <comp> <subject-expr>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject)))) (case> (#error.Success valueT) @@ -86,7 +86,7 @@ (n/% (i64.left-shift 8 1)) (:coerce Int))] )) - (~~ (do-template [<name> <reference> <outputT> <comp>] + (~~ (template [<name> <reference> <outputT> <comp>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.i64 subject) (synthesis.i64 param)))) @@ -116,7 +116,7 @@ [param (|> ..simple-frac (r.filter (|>> (f/= +0.0) not))) subject ..simple-frac] (`` ($_ seq - (~~ (do-template [<name> <reference> <comp>] + (~~ (template [<name> <reference> <comp>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.f64 subject) (synthesis.f64 param)))) @@ -128,7 +128,7 @@ ["lux f64 /" f// f/=] ["lux f64 %" f/% f/=] )) - (~~ (do-template [<name> <text>] + (~~ (template [<name> <text>] [(test <name> (|> (run (#synthesis.Extension <name> (list (synthesis.f64 subject) (synthesis.f64 param)))) @@ -142,7 +142,7 @@ ["lux f64 =" f/=] ["lux f64 <" f/<] )) - (~~ (do-template [<name> <reference>] + (~~ (template [<name> <reference>] [(test <name> (|> (run (#synthesis.Extension <name> (list))) (&.check <reference>)))] diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/new-luxc/test/test/luxc/lang/translation/js.lux index 8175e82fc..83108c594 100644 --- a/new-luxc/test/test/luxc/lang/translation/js.lux +++ b/new-luxc/test/test/luxc/lang/translation/js.lux @@ -30,7 +30,7 @@ (type: Check (-> (e.Error Any) Bit)) -(do-template [<name> <type> <pre> <=>] +(template [<name> <type> <pre> <=>] [(def: (<name> angle) (-> <type> Check) (|>> (case> (#e.Success valueV) diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/new-luxc/test/test/luxc/lang/translation/jvm.lux index f31496b08..7c97b1e78 100644 --- a/new-luxc/test/test/luxc/lang/translation/jvm.lux +++ b/new-luxc/test/test/luxc/lang/translation/jvm.lux @@ -29,7 +29,7 @@ (do @ [int-sample (|> r.int (:: @ map (i/% 128))) #let [frac-sample (int-to-frac int-sample)]] - (with-expansions [<2step> (do-template [<step1> <step2> <tag> <sample> <cast> <test>] + (with-expansions [<2step> (template [<step1> <step2> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> (`)))] @@ -61,7 +61,7 @@ [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs))) #let [frac-sample (int-to-frac int-sample)]] (`` ($_ seq - (~~ (do-template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] + (~~ (template [<step1> <step2> <step3> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> (`)))] @@ -88,7 +88,7 @@ [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs))) #let [frac-sample (int-to-frac int-sample)]] (`` ($_ seq - (~~ (do-template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] + (~~ (template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>] [(test (format <step1> " / " <step2> " / " <step3>) (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (~ (<tag> <sample>)) <step1> <step2> <step3> <step4> (`)))] @@ -121,13 +121,13 @@ (r.Random Frac) (|> gen-int (r/map int-to-frac))) -(do-template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>] +(template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>] [(context: (format "Arithmetic [" <domain> "]") (<| (times +100) (do @ [param <generator> #let [subject (<augmentation> param)]] - (with-expansions [<tests> (do-template [<procedure> <reference>] + (with-expansions [<tests> (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -159,14 +159,14 @@ ["double" gen-frac code.frac Frac f/= (f/* 10.0) f/+ f/- f/* f// f/% id id] ) -(do-template [<domain> <post> <convert>] +(template [<domain> <post> <convert>] [(context: (format "Bit-wise [" <domain> "] { Combiners ]") (<| (times +100) (do @ [param gen-nat subject gen-nat] (`` ($_ seq - (~~ (do-template [<procedure> <reference>] + (~~ (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -192,7 +192,7 @@ ["long" id id] ) -(do-template [<domain> <post> <convert>] +(template [<domain> <post> <convert>] [(context: (format "Bit-wise [" <domain> "] { Shifters }") (<| (times +100) (do @ @@ -200,7 +200,7 @@ subject gen-nat #let [shift (n/% +10 param)]] (`` ($_ seq - (~~ (do-template [<procedure> <reference> <type> <test> <pre-subject> <pre>] + (~~ (template [<procedure> <reference> <type> <test> <pre-subject> <pre>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (<post> ((code.text <procedure>) @@ -226,13 +226,13 @@ ["long" id id] ) -(do-template [<domain> <generator> <tag> <=> <<> <pre>] +(template [<domain> <generator> <tag> <=> <<> <pre>] [(context: (format "Order [" <domain> "]") (<| (times +100) (do @ [param <generator> subject <generator>] - (with-expansions [<tests> (do-template [<procedure> <reference>] + (with-expansions [<tests> (template [<procedure> <reference>] [(test <procedure> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate ((code.text <procedure>) @@ -287,7 +287,7 @@ valueF gen-frac valueD r.frac valueC gen-int] - (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] + (with-expansions [<array> (template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (jvm//array//new +0 <class> size) @@ -335,7 +335,7 @@ valueF gen-frac valueD r.frac valueC gen-int] - (with-expansions [<array> (do-template [<class> <type> <value> <test> <input> <post>] + (with-expansions [<array> (template [<class> <type> <value> <test> <input> <post>] [(test <class> (|> (do macro.Monad<Meta> [sampleI (expressionT.translate (|> (jvm//array//new +0 <class> size) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index ee8e53d5e..f3c6c8fc3 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -34,7 +34,7 @@ |f64| r.frac |text| (r.ascii 5)] (`` ($_ seq - (~~ (do-template [<desc> <type> <synthesis> <sample> <test>] + (~~ (template [<desc> <type> <synthesis> <sample> <test>] [(test (format "Can translate " <desc> ".") (|> (run (<synthesis> <sample>)) (case> (#error.Success valueT) |