diff options
author | Eduardo Julian | 2021-06-11 02:48:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-06-11 02:48:13 -0400 |
commit | 8f575da5095e3b259d4eb6b6f13d3e37ef1d38e4 (patch) | |
tree | d4ad0bf5582637395508b4a260491373d55e760b /stdlib/source/lux/tool | |
parent | 486488ae17007406a6c90f182b85f7be14b6b373 (diff) |
Added import name formatting to "import:" macros for other backends.
Diffstat (limited to 'stdlib/source/lux/tool')
15 files changed, 76 insertions, 82 deletions
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 860badea3..d36dcd1ef 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -1,6 +1,6 @@ (.module: [lux #* - ["." host] + ["." ffi] [abstract ["." monad (#+ do)]] [control @@ -198,7 +198,7 @@ [#let [inputT (type.tuple (list.repeat arity Any))] abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) - _ (analysis/type.infer (for {@.js host.Function} + _ (analysis/type.infer (for {@.js ffi.Function} Any))] (wrap (#analysis.Extension extension (list (analysis.nat arity) abstractionA)))))])) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index 99154e105..8f97d1ba9 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -1,11 +1,11 @@ (.module: [lux #* - ["." host] + ["." ffi] [abstract ["." monad (#+ do)]] [control ["<>" parser - ["<c>" code (#+ Parser)]]] + ["<.>" code (#+ Parser)]]] [data [collection ["." array (#+ Array)] @@ -28,21 +28,21 @@ ["." phase]]]]]]) (def: Nil - (for {@.lua host.Nil} + (for {@.lua ffi.Nil} Any)) (def: Object - (for {@.lua (type (host.Object Any))} + (for {@.lua (type (ffi.Object Any))} Any)) (def: Function - (for {@.lua host.Function} + (for {@.lua ffi.Function} Any)) (def: array::new Handler (custom - [<c>.any + [<code>.any (function (_ extension phase archive lengthC) (do phase.monad [lengthA (analysis/type.with_type Nat @@ -54,7 +54,7 @@ (def: array::length Handler (custom - [<c>.any + [<code>.any (function (_ extension phase archive arrayC) (do phase.monad [[var_id varT] (analysis/type.with_env check.var) @@ -66,7 +66,7 @@ (def: array::read Handler (custom - [(<>.and <c>.any <c>.any) + [(<>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -80,7 +80,7 @@ (def: array::write Handler (custom - [($_ <>.and <c>.any <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -96,7 +96,7 @@ (def: array::delete Handler (custom - [($_ <>.and <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -121,7 +121,7 @@ (def: object::get Handler (custom - [($_ <>.and <c>.text <c>.any) + [($_ <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.with_type ..Object @@ -133,7 +133,7 @@ (def: object::do Handler (custom - [($_ <>.and <c>.text <c>.any (<>.some <c>.any)) + [($_ <>.and <code>.text <code>.any (<>.some <code>.any)) (function (_ extension phase archive [methodC objectC inputsC]) (do {! phase.monad} [objectA (analysis/type.with_type ..Object @@ -158,7 +158,7 @@ [(def: <name> Handler (custom - [<c>.any + [<code>.any (function (_ extension phase archive inputC) (do {! phase.monad} [inputA (analysis/type.with_type (type <fromT>) @@ -181,7 +181,7 @@ (def: lua::constant Handler (custom - [<c>.text + [<code>.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] @@ -190,7 +190,7 @@ (def: lua::apply Handler (custom - [($_ <>.and <c>.any (<>.some <c>.any)) + [($_ <>.and <code>.any (<>.some <code>.any)) (function (_ extension phase archive [abstractionC inputsC]) (do {! phase.monad} [abstractionA (analysis/type.with_type ..Function @@ -202,7 +202,7 @@ (def: lua::power Handler (custom - [($_ <>.and <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any) (function (_ extension phase archive [powerC baseC]) (do {! phase.monad} [powerA (analysis/type.with_type Frac @@ -215,7 +215,7 @@ (def: lua::import Handler (custom - [<c>.text + [<code>.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] @@ -224,7 +224,7 @@ (def: lua::function Handler (custom - [($_ <>.and <c>.nat <c>.any) + [($_ <>.and <code>.nat <code>.any) (function (_ extension phase archive [arity abstractionC]) (do phase.monad [#let [inputT (type.tuple (list.repeat arity Any))] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index 78e1a4f5a..53e6c0b05 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -1,11 +1,11 @@ (.module: [lux #* - ["." host] + ["." ffi] [abstract ["." monad (#+ do)]] [control ["<>" parser - ["<c>" code (#+ Parser)]]] + ["<.>" code (#+ Parser)]]] [data [collection ["." array (#+ Array)] @@ -30,7 +30,7 @@ (def: array::new Handler (custom - [<c>.any + [<code>.any (function (_ extension phase archive lengthC) (do phase.monad [lengthA (analysis/type.with_type Nat @@ -42,7 +42,7 @@ (def: array::length Handler (custom - [<c>.any + [<code>.any (function (_ extension phase archive arrayC) (do phase.monad [[var_id varT] (analysis/type.with_env check.var) @@ -54,7 +54,7 @@ (def: array::read Handler (custom - [(<>.and <c>.any <c>.any) + [(<>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -68,7 +68,7 @@ (def: array::write Handler (custom - [($_ <>.and <c>.any <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -84,7 +84,7 @@ (def: array::delete Handler (custom - [($_ <>.and <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (do phase.monad [indexA (analysis/type.with_type Nat @@ -108,25 +108,25 @@ (def: None (for {@.python - host.None} + ffi.None} Any)) (def: Object - (for {@.python (type (host.Object Any))} + (for {@.python (type (ffi.Object Any))} Any)) (def: Function - (for {@.python host.Function} + (for {@.python ffi.Function} Any)) (def: Dict - (for {@.python host.Dict} + (for {@.python ffi.Dict} Any)) (def: object::get Handler (custom - [($_ <>.and <c>.text <c>.any) + [($_ <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.with_type ..Object @@ -138,7 +138,7 @@ (def: object::do Handler (custom - [($_ <>.and <c>.text <c>.any (<>.some <c>.any)) + [($_ <>.and <code>.text <code>.any (<>.some <code>.any)) (function (_ extension phase archive [methodC objectC inputsC]) (do {! phase.monad} [objectA (analysis/type.with_type ..Object @@ -162,7 +162,7 @@ (def: python::constant Handler (custom - [<c>.text + [<code>.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] @@ -171,7 +171,7 @@ (def: python::import Handler (custom - [<c>.text + [<code>.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] @@ -180,7 +180,7 @@ (def: python::apply Handler (custom - [($_ <>.and <c>.any (<>.some <c>.any)) + [($_ <>.and <code>.any (<>.some <code>.any)) (function (_ extension phase archive [abstractionC inputsC]) (do {! phase.monad} [abstractionA (analysis/type.with_type ..Function @@ -192,7 +192,7 @@ (def: python::function Handler (custom - [($_ <>.and <c>.nat <c>.any) + [($_ <>.and <code>.nat <code>.any) (function (_ extension phase archive [arity abstractionC]) (do phase.monad [#let [inputT (type.tuple (list.repeat arity Any))] @@ -205,7 +205,7 @@ (def: python::exec Handler (custom - [($_ <>.and <c>.any <c>.any) + [($_ <>.and <code>.any <code>.any) (function (_ extension phase archive [codeC globalsC]) (do phase.monad [codeA (analysis/type.with_type Text diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index 8bbd32b3c..0fda869e9 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -1,6 +1,6 @@ (.module: [lux #* - ["." host] + ["." ffi] [abstract ["." monad (#+ do)]] [control @@ -107,15 +107,15 @@ ))) (def: Nil - (for {@.ruby host.Nil} + (for {@.ruby ffi.Nil} Any)) (def: Object - (for {@.ruby (type (host.Object Any))} + (for {@.ruby (type (ffi.Object Any))} Any)) (def: Function - (for {@.ruby host.Function} + (for {@.ruby ffi.Function} Any)) (def: object::get diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux index 4d403e22e..660ac4991 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -118,5 +118,5 @@ @self)))))))) ))] _ (/////generation.execute! definition) - _ (/////generation.save! (%.nat (product.right function_name)) definition)] + _ (/////generation.save! (product.right function_name) definition)] (wrap instantiation))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 5a4375dad..c307f4302 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -11,7 +11,8 @@ ["." product] ["." text ("#\." hash) ["%" format (#+ format)] - ["." encoding]] + [encoding + ["." utf8]]] [collection ["." list ("#\." functor)] ["." row]]] @@ -33,12 +34,12 @@ ["//#" /// #_ ["#." synthesis (#+ Synthesis)] ["#." generation] - ["//#" /// (#+ Output) + ["//#" /// ["#." phase] [reference [variable (#+ Register)]] [meta - [archive (#+ Archive) + [archive (#+ Output Archive) ["." artifact (#+ Registry)]]]]]]) (template [<name> <base>] @@ -60,10 +61,6 @@ (type: #export (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: prefix - Text - "LuxRuntime") - (def: #export high (-> (I64 Any) (I64 Any)) (i64.right_shift 32)) @@ -770,19 +767,18 @@ runtime//lux )) -(def: #export artifact - Text - ..prefix) +(def: module_id + 0) (def: #export generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! "0" ..runtime)] + _ (/////generation.save! ..module_id ..runtime)] (wrap [(|> artifact.empty artifact.resource product.right) - (row.row ["0" + (row.row [..module_id (|> ..runtime _.code - (\ encoding.utf8 encode))])]))) + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index 4d3253d48..55490d3f2 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -132,5 +132,5 @@ (_.apply/1 @self)))))))) ))] _ (/////generation.execute! definition) - _ (/////generation.save! (%.nat (product.right function_name)) definition)] + _ (/////generation.save! (product.right function_name) definition)] (wrap instantiation))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 46fa94dd2..e95fc0f49 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -107,7 +107,7 @@ )) (|> @context (_.apply/* foreigns))])))] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat artifact_id) directive)] + _ (/////generation.save! artifact_id directive)] (wrap (|> instantiation (_.apply/* initsO+)))))) (def: #export (recur! statement expression archive argsS+) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index fd1cfa2b4..0da87ff6a 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -11,7 +11,8 @@ ["." product] ["." text ("#\." hash) ["%" format (#+ format)] - ["." encoding]] + [encoding + ["." utf8]]] [collection ["." list ("#\." functor)] ["." row]]] @@ -55,9 +56,6 @@ (type: #export (Generator! i) (-> Phase! Phase Archive i (Operation Statement))) -(def: prefix - "LuxRuntime") - (def: #export unit (_.string /////synthesis.unit)) @@ -419,17 +417,15 @@ ..runtime//array )) -(def: #export artifact ..prefix) - (def: #export generate (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! (%.nat ..module_id) ..runtime)] + _ (/////generation.save! ..module_id ..runtime)] (wrap [(|> artifact.empty artifact.resource product.right) - (row.row [(%.nat ..module_id) + (row.row [..module_id (|> ..runtime _.code - (\ encoding.utf8 encode))])]))) + (\ utf8.codec encode))])]))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 202e922c1..23368285c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -313,5 +313,5 @@ directive (_.def @case @dependencies+ pattern_matching!)] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat case_artifact) directive)] + _ (/////generation.save! case_artifact directive)] (wrap (_.apply/* @case @dependencies+)))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux index f2c71eae8..cc670d277 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -47,7 +47,7 @@ #.Nil (do ///////phase.monad [_ (/////generation.execute! function_definition) - _ (/////generation.save! (%.nat function_id) function_definition)] + _ (/////generation.save! function_id function_definition)] (wrap @function)) _ @@ -59,7 +59,7 @@ function_definition (_.return @function)))] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat function_id) directive)] + _ (/////generation.save! function_id directive)] (wrap (_.apply/* @function inits))))) (def: input diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 83f093001..0f932ee38 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -102,7 +102,7 @@ )) (_.apply/* @loop foreigns)]))] _ (/////generation.execute! directive) - _ (/////generation.save! (%.nat loop_artifact) directive)] + _ (/////generation.save! loop_artifact directive)] (wrap (_.apply/* instantiation initsO+))))) (def: #export (recur! statement expression archive argsS+) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index f12c8f08b..2345ab763 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -11,7 +11,8 @@ ["." product] ["." text ("#\." hash) ["%" format (#+ format)] - ["." encoding]] + [encoding + ["." utf8]]] [collection ["." list ("#\." functor)] ["." row]]] @@ -425,19 +426,19 @@ runtime//array )) -(def: #export artifact - ..prefix) +(def: module_id + 0) (def: #export generate (Operation [Registry Output]) (/////generation.with_buffer (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! ..prefix ..runtime)] + _ (/////generation.save! ..module_id ..runtime)] (wrap [(|> artifact.empty artifact.resource product.right) - (row.row ["0" + (row.row [..module_id (|> ..runtime _.code - (\ encoding.utf8 encode))])])))) + (\ utf8.codec encode))])])))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index 21d74f8cd..535453f2e 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -107,5 +107,5 @@ (_.do "concat" (list @missing)))))))))))) )))] _ (/////generation.execute! declaration) - _ (/////generation.save! (%.nat function_artifact) declaration)] + _ (/////generation.save! function_artifact declaration)] (wrap instatiation))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index 01befb892..2eb8ec79c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -11,7 +11,8 @@ ["." product] ["." text ("#\." hash) ["%" format (#+ format)] - ["." encoding]] + [encoding + ["." utf8]]] [collection ["." list ("#\." functor)] ["." row]]] @@ -391,11 +392,11 @@ (Operation [Registry Output]) (do ///////phase.monad [_ (/////generation.execute! ..runtime) - _ (/////generation.save! (%.nat ..module_id) ..runtime)] + _ (/////generation.save! ..module_id ..runtime)] (wrap [(|> artifact.empty artifact.resource product.right) - (row.row [(%.nat ..module_id) + (row.row [..module_id (|> ..runtime _.code - (\ encoding.utf8 encode))])]))) + (\ utf8.codec encode))])]))) |