(.require [library [lux (.except) [abstract ["[0]" monad]] [control ["<>" parser (.use "[1]#[0]" monad)]] [data ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor)]]] [meta ["@" target (.only) [jvm ["_" bytecode (.only Bytecode)]]] ["[0]" code (.only) ["" \\parser (.only Parser)]] [macro (.only with_symbols) [syntax (.only syntax)] ["[0]" template]] [compiler ["[0]" phase] [language [lux ["[0]" analysis (.only) ["" \\parser]] ["[0]" synthesis (.only) ["" \\parser]] ["[0]" generation] ["[0]" declaration] [phase [generation ["[0]" jvm ["[1]" runtime]] ["[0]" js ["[1]" runtime]] ["[0]" lua ["[1]" runtime]] ["[0]" python ["[1]" runtime]] ["[0]" ruby ["[1]" runtime]]]]]]]]]]) (with_template [ ] [(def .public (syntax (_ [[handler phase archive inputs] (.form (all <>.and .local .local .local (.tuple (<>.some .any)))) body .any]) (let [g!handler (code.local handler) g!phase (code.local phase) g!archive (code.local archive)] (with_symbols [g!inputs g!error g!_] (in (list (` (<| (as ) (is ) (.function ((, g!handler) (, g!phase) (, g!archive) (, g!inputs)) (.when ( (monad.do <>.monad [(,* inputs) (, g!_) ] (.at <>.monad (,' in) (, body))) (, g!inputs)) {.#Right (, g!_)} (, g!_) {.#Left (, g!error)} (phase.failure (, g!error))) )))))))))] [.any .end .and .result analysis .Analysis analysis.Handler] [.any .end .and .result synthesis .Synthesis synthesis.Handler] [.any .end .and .result generation .Generation (for @.jvm (generation.Handler jvm.Anchor jvm.Value jvm.Declaration) @.js (generation.Handler js.Anchor js.Value js.Declaration) @.lua (generation.Handler lua.Anchor lua.Value lua.Declaration) @.python (generation.Handler python.Anchor python.Value python.Declaration) @.ruby (generation.Handler ruby.Anchor ruby.Value ruby.Declaration))] [.any .end .and .result declaration .Declaration (for @.jvm (declaration.Handler jvm.Anchor jvm.Value jvm.Declaration) @.js (declaration.Handler js.Anchor js.Value js.Declaration) @.lua (declaration.Handler lua.Anchor lua.Value lua.Declaration) @.python (declaration.Handler python.Anchor python.Value python.Declaration) @.ruby (declaration.Handler ruby.Anchor ruby.Value ruby.Declaration))] )