diff options
author | Eduardo Julian | 2017-12-02 01:06:34 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-12-02 01:06:34 -0400 |
commit | f92c4dc2f813b40f14d240491daa665942165e7e (patch) | |
tree | 400ed9320de4b7f61ac8b92e28ad6835a1ce370b /new-luxc/source/luxc/lang/translation | |
parent | 414c0a1a1f53322d8f4c11230ded98c5b83b6310 (diff) |
- Adjusted new-luxc to new macro-templating syntax.
Diffstat (limited to '')
5 files changed, 19 insertions, 18 deletions
diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 07f1fe533..71bef93a2 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -72,7 +72,7 @@ (def: #export (translate translate-module aliases code) (-> (-> Text Compiler (Process Compiler)) Aliases Code (Meta Aliases)) (case code - (^code ((~ [_ (#.Symbol macro-name)]) (~@ args))) + (^code ((~ [_ (#.Symbol macro-name)]) (~+ args))) (do macro.Monad<Meta> [?macro (&.with-error-tracking (macro.find-macro macro-name))] diff --git a/new-luxc/source/luxc/lang/translation/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/eval.jvm.lux index 9cce16a49..2236815ea 100644 --- a/new-luxc/source/luxc/lang/translation/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/eval.jvm.lux @@ -25,7 +25,7 @@ (-> $.Inst (Meta Top)) (do macro.Monad<Meta> [current-module macro.current-module-name - class-name (:: @ map %code (macro.gensym (format current-module "/eval"))) + [_ class-name] (macro.gensym (format current-module "/eval")) #let [store-name (text.replace-all "/" "." class-name) bytecode ($d.class #$.V1_6 #$.Public $.noneC diff --git a/new-luxc/source/luxc/lang/translation/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/expression.jvm.lux index c75ef0a19..4496de784 100644 --- a/new-luxc/source/luxc/lang/translation/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/expression.jvm.lux @@ -44,7 +44,7 @@ (^code ((~ [_ (#.Nat tag)]) (~ [_ (#.Bool last?)]) (~ valueS))) (structureT.translate-variant translate tag last? valueS) - (^code [(~@ members)]) + (^code [(~+ members)]) (structureT.translate-tuple translate members) (^ [_ (#.Form (list [_ (#.Int var)]))]) @@ -61,14 +61,14 @@ (^code ("lux case" (~ inputS) (~ pathPS))) (caseT.translate-case translate inputS pathPS) - (^multi (^code ("lux function" (~ [_ (#.Nat arity)]) [(~@ environment)] (~ bodyS))) + (^multi (^code ("lux function" (~ [_ (#.Nat arity)]) [(~+ environment)] (~ bodyS))) [(s.run environment (p.some s.int)) (#e.Success environment)]) (functionT.translate-function translate environment arity bodyS) - (^code ("lux call" (~ functionS) (~@ argsS))) + (^code ("lux call" (~ functionS) (~+ argsS))) (functionT.translate-call translate functionS argsS) - (^code ((~ [_ (#.Text procedure)]) (~@ argsS))) + (^code ((~ [_ (#.Text procedure)]) (~+ argsS))) (procedureT.translate-procedure translate procedure argsS) _ diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux index 41d9b91ab..91c5c5f95 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux @@ -47,7 +47,7 @@ (Dict Text Proc)) (syntax: (Vector [size s.nat] elemT) - (wrap (list (` [(~@ (list.repeat size elemT))])))) + (wrap (list (` [(~+ (list.repeat size elemT))])))) (type: #export Nullary (-> (Vector +0 $.Inst) $.Inst)) (type: #export Unary (-> (Vector +1 $.Inst) $.Inst)) @@ -84,23 +84,24 @@ (syntax: (arity: [name s.local-symbol] [arity s.nat]) (with-gensyms [g!proc g!name g!translate g!inputs] (do @ - [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] - (wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!proc)) + [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input"))) + #let [g!input+ (list/map code.symbol g!input+)]] + (wrap (list (` (def: #export ((~ (code.local-symbol name)) (~@ g!proc)) (-> (-> (..Vector (~ (code.nat arity)) $.Inst) $.Inst) (-> Text ..Proc)) - (function [(~ g!name)] - (function [(~ g!translate) (~ g!inputs)] - (case (~ g!inputs) - (^ (list (~@ g!input+))) + (function [(~@ g!name)] + (function [(~@ g!translate) (~@ g!inputs)] + (case (~@ g!inputs) + (^ (list (~+ g!input+))) (do macro.Monad<Meta> - [(~@ (|> g!input+ + [(~+ (|> g!input+ (list/map (function [g!input] - (list g!input (` ((~ g!translate) (~ g!input)))))) + (list g!input (` ((~@ g!translate) (~ g!input)))))) list.concat))] - ((~' wrap) ((~ g!proc) [(~@ g!input+)]))) + ((~' wrap) ((~@ g!proc) [(~+ g!input+)]))) (~' _) - (macro.fail (wrong-arity (~ g!name) +1 (list.size (~ g!inputs)))))))))))))) + (macro.fail (wrong-arity (~@ g!name) +1 (list.size (~@ g!inputs)))))))))))))) (arity: nullary +0) (arity: unary +1) diff --git a/new-luxc/source/luxc/lang/translation/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/structure.jvm.lux index 9a78be78e..f7cdb524f 100644 --- a/new-luxc/source/luxc/lang/translation/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/structure.jvm.lux @@ -24,7 +24,7 @@ (-> (-> ls.Synthesis (Meta $.Inst)) (List ls.Synthesis) (Meta $.Inst)) (do macro.Monad<Meta> [#let [size (list.size members)] - _ (&.assert Not-A-Tuple (%code (` [(~@ members)])) + _ (&.assert Not-A-Tuple (%code (` [(~+ members)])) (n/>= +2 size)) membersI (|> members list.enumerate |