(.module: [library [lux #* ["." debug] ["@" target ["." jvm] ["." js] ["." python] ["." lua] ["." ruby] ["." php] ["." scheme]] [abstract ["." monad (#+ do)]] [control ["." try] ["<>" parser ["<.>" code] ["<.>" analysis] ["<.>" synthesis]]] [data ["." product] ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection ["." row] ["." list ("#\." functor)]]] [math ["." random] [number ["n" nat]]] [tool [compiler ["." phase] [language [lux ["." analysis] ["." synthesis] ["." directive] [phase [analysis ["." type]]]]]]] ["_" test (#+ Test)]]] [\\library ["." / (#+ analysis: synthesis: generation: directive:)]]) (def: my_analysis "my analysis") (def: my_synthesis "my synthesis") (def: my_generation "my generation") (def: dummy_generation "dummy generation") (def: my_directive "my directive") ... Generation (for {@.old (as_is)} (as_is ... Analysis (analysis: (..my_analysis self phase archive [pass_through .any]) (phase archive pass_through)) ... Synthesis (analysis: (..my_synthesis self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.map ! (phase archive)) (\ ! map (|>> (#analysis.Extension self)))))) (synthesis: (..my_synthesis self phase archive [pass_through .any]) (phase archive pass_through)) ... Generation (analysis: (..my_generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.map ! (phase archive)) (\ ! map (|>> (#analysis.Extension self)))))) (synthesis: (..my_generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.map ! (phase archive)) (\ ! map (|>> (#synthesis.Extension self)))))) (generation: (..my_generation self phase archive [pass_through .any]) (for {@.jvm (\ phase.monad map (|>> #jvm.Embedded row.row) (phase archive pass_through))} (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 (row.row (#jvm.Constant (#jvm.LDC (#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: (..my_directive self phase archive [parameters (<>.some .any)]) (do phase.monad [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] (in directive.no_requirements))) (`` ((~~ (static ..my_directive)))) )) (def: .public test Test (<| (_.covering /._) (do random.monad [expected random.nat] (`` ($_ _.and (~~ (template [ ] [(_.cover [] (for {@.old false} (n.= expected (`` ((~~ (static )) expected)))))] [/.analysis: ..my_analysis] [/.synthesis: ..my_synthesis])) (_.cover [/.generation:] (for {@.old false} (and (n.= expected (`` ((~~ (static ..my_generation)) expected))) (text\= ..dummy_generation (`` ((~~ (static ..dummy_generation)))))))) (_.cover [/.directive:] true) )))))