(.`` (.`` (.using [library [lux "*" ["[0]" debug] ["@" target ["[0]" js] ["[0]" python] ["[0]" lua] ["[0]" ruby] ["[0]" php] ["[0]" scheme] ["[0]" jvm "_" (~~ (.for "JVM" (~~ (.these ["[1]" bytecode] ["[0]" class] ["[0]" version] [encoding ["[0]" name]])) (~~ (.these))))]] [abstract ["[0]" monad {"+" do}]] [control ["[0]" try ("[1]#[0]" functor)] ["<>" parser ["<[0]>" code] ["<[0]>" analysis] ["<[0]>" synthesis]]] [data ["[0]" binary] ["[0]" product] ["[0]" text ("[1]#[0]" equivalence) ["%" format {"+" format}]] [collection ["[0]" sequence] ["[0]" list ("[1]#[0]" functor)]] [format ["[0]F" binary]]] [macro ["[0]" template]] [math ["[0]" random] [number ["n" nat]]] [tool [compiler ["[0]" phase] [meta [archive ["[0]" unit]]] [language [lux ["[0]" synthesis] ["[0]" generation] ["[0]" directive] ["[0]" analysis ["[0]" type]] [phase [generation (~~ (.for "JVM" (~~ (.these ["[0]" jvm "_" ["[1]/[0]" runtime]])) (~~ (.these))))]]]]]] ["_" test {"+" Test}]]] [\\library ["[0]" / {"+" analysis: synthesis: generation: directive:}]]))) (def: dummy_generation "dummy generation") (template [] [(def: Text (`` (%.symbol (symbol (~~ (template.symbol [.._ ]))))))] [analysis] [synthesis] [generation] [directive] ) ... Generation (for @.old (these) (these (for @.python ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. (analysis: ("dummy dum dum" self phase archive []) (undefined)) (these)) ... Analysis (analysis: (..analysis self phase archive [pass_through .any]) (phase archive pass_through)) ... Synthesis (analysis: (..synthesis self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {analysis.#Extension self}))))) (synthesis: (..synthesis self phase archive [pass_through .any]) (phase archive pass_through)) ... Generation (analysis: (..generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {analysis.#Extension self}))))) (synthesis: (..generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {synthesis.#Extension self}))))) (generation: (..generation self phase archive [pass_through .any]) (phase archive pass_through)) (analysis: (..dummy_generation self phase archive []) (# phase.monad in {analysis.#Extension self (list)})) (synthesis: (..dummy_generation self phase archive []) (# phase.monad in {synthesis.#Extension self (list)})) (generation: (..dummy_generation self phase archive []) (# 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)))) ... Directive (directive: (..directive self phase archive [expression .any]) (do [! phase.monad] [analysis_phase directive.analysis expressionA (<| directive.lifted_analysis (type.expecting .Any) (analysis_phase archive expression)) synthesis_phase directive.synthesis expressionS (directive.lifted_synthesis (synthesis_phase archive expressionA)) generation_phase directive.generation expressionG (directive.lifted_generation (generation_phase archive expressionS)) _ (directive.lifted_generation (generation.with_new_context archive unit.none (do ! [[module_id artifact_id] (generation.context archive) .let [commentary (format "Successfully installed directive " (%.text self) "!")] _ (generation.save! artifact_id {.#None} (for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] (<| [$class] (try.else (binary.empty 0)) (try#each (binaryF.result class.writer)) (class.class version.v6_0 class.public (name.internal $class) {.#None} (name.internal "java.lang.Object") (list) (list) (list) sequence.empty))) @.js (js.comment commentary (js.statement (js.string commentary))) @.python (python.comment commentary (python.statement (python.string commentary))) @.lua (lua.comment commentary (lua.statement expressionG)) @.ruby (ruby.comment commentary (ruby.statement (ruby.string commentary)))))] (generation.log! commentary))))] (in directive.no_requirements))) (`` ((~~ (static ..directive)) (n.* 2 3))) )) (def: .public test Test (<| (_.covering /._) (do random.monad [expected random.nat] (`` (all _.and (~~ (template [ ] [(_.cover [] (for @.old false (n.= expected (`` ((~~ (static )) expected)))))] [/.analysis: ..analysis] [/.synthesis: ..synthesis])) (_.cover [/.generation:] (for @.old false (and (n.= expected (`` ((~~ (static ..generation)) expected))) (text#= ..dummy_generation (`` ((~~ (static ..dummy_generation)))))))) (_.cover [/.directive:] true) )))))