From 53704218a3705132dbe807a8ef54f938809f84d5 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 1 Oct 2022 16:33:20 -0400 Subject: New format for extensions [part 0] --- stdlib/source/test/lux/meta/extension.lux | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index 66bf59e0e..419570970 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -20,7 +20,7 @@ ["[0]" random] [number ["n" nat]]] - [meta + ["[0]" meta (.only) ["[0]" code ["<[1]>" \\parser]] [macro @@ -54,6 +54,7 @@ ["[0]" synthesis (.only) ["<[1]>" \\parser]] [phase + ["[0]" extension] [generation (.,, (.for "JVM" (.,, (.these ["[0]" jvm ["[1]/[0]" runtime]])) @@ -103,6 +104,11 @@ (phase archive pass_through)) ... Generation + (def my_generation|generation + Generation + (generation (_ self phase archive [pass_through .any]) + (phase archive pass_through))) + (analysis (..my_generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters @@ -113,26 +119,26 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (at ! each (|>> {synthesis.#Extension self}))))) - - (generation (..my_generation self phase archive [pass_through .any]) - (phase archive pass_through)) + (at ! each (|>> {synthesis.#Extension (symbol ..my_generation|generation)}))))) + + (def dummy_generation|generation + Generation + (generation (_ self phase archive []) + (let [self ..dummy_generation] + (at phase.monad in + (for @.jvm (jvm.string self) + @.js (js.string self) + @.python (python.unicode self) + @.lua (lua.string self) + @.ruby (ruby.string self) + @.php (php.string self) + @.scheme (scheme.string self)))))) (analysis (..dummy_generation self phase archive []) (at phase.monad in {analysis.#Extension self (list)})) (synthesis (..dummy_generation self phase archive []) - (at phase.monad in {synthesis.#Extension self (list)})) - - (generation (..dummy_generation self phase archive []) - (at phase.monad in - (for @.jvm (jvm.string self) - @.js (js.string self) - @.python (python.unicode self) - @.lua (lua.string self) - @.ruby (ruby.string self) - @.php (php.string self) - @.scheme (scheme.string self)))) + (at phase.monad in {synthesis.#Extension (symbol ..dummy_generation|generation) (list)})) ... Declaration (declaration (..my_declaration self phase archive [expression .any]) @@ -146,9 +152,12 @@ expressionS (declaration.lifted_synthesis (synthesis_phase archive expressionA)) + lux (<| declaration.lifted_analysis + extension.lifted + meta.compiler_state) generation_phase declaration.generation expressionG (declaration.lifted_generation - (generation_phase archive expressionS)) + (generation_phase lux archive expressionS)) _ (declaration.lifted_generation (generation.with_new_context archive unit.none -- cgit v1.2.3