diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/phase/extension/statement.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/extension/statement.lux | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux index 83e7320d8..5c957aab1 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux @@ -13,30 +13,30 @@ [type (#+ :share :by-example) ["." check]]] ["." // - ["." bundle] - ["/." // + ["#." bundle] + ["#/" // [analysis ["." module] ["." type]] - ["." generation] - [// - ["." analysis] - ["." synthesis (#+ Synthesis)] - ["." statement (#+ Operation Handler Bundle)]]]]) + ["#." generation] + ["#/" // #_ + ["#." analysis] + ["#." synthesis (#+ Synthesis)] + ["#." statement (#+ Operation Handler Bundle)]]]]) ## TODO: Inline "evaluate!'" into "evaluate!" ASAP (def: (evaluate!' generate code//type codeS) (All [anchor expression statement] - (-> (generation.Phase anchor expression statement) + (-> (///generation.Phase anchor expression statement) Type Synthesis (Operation anchor expression statement [Type expression Any]))) - (statement.lift-generation - (generation.with-buffer + (////statement.lift-generation + (///generation.with-buffer (do ///.monad [codeT (generate codeS) - count generation.next - codeV (generation.evaluate! (format "evaluate" (%n count)) codeT)] + count ///generation.next + codeV (///generation.evaluate! (format "evaluate" (%n count)) codeT)] (wrap [code//type codeT codeV]))))) (def: (evaluate! type codeC) @@ -44,33 +44,33 @@ (-> Type Code (Operation anchor expression statement [Type expression Any]))) (do ///.monad [state (//.lift ///.get-state) - #let [analyse (get@ [#statement.analysis #statement.phase] state) - synthesize (get@ [#statement.synthesis #statement.phase] state) - generate (get@ [#statement.generation #statement.phase] state)] - [_ code//type codeA] (statement.lift-analysis - (analysis.with-scope + #let [analyse (get@ [#////statement.analysis #////statement.phase] state) + synthesize (get@ [#////statement.synthesis #////statement.phase] state) + generate (get@ [#////statement.generation #////statement.phase] state)] + [_ code//type codeA] (////statement.lift-analysis + (////analysis.with-scope (type.with-fresh-env (type.with-type type (do @ [codeA (analyse codeC)] (wrap [type codeA])))))) - codeS (statement.lift-synthesis + codeS (////statement.lift-synthesis (synthesize codeA))] (evaluate!' generate code//type codeS))) ## TODO: Inline "definition'" into "definition" ASAP (def: (definition' generate name code//type codeS) (All [anchor expression statement] - (-> (generation.Phase anchor expression statement) + (-> (///generation.Phase anchor expression statement) Name Type Synthesis (Operation anchor expression statement [Type expression Text Any]))) - (statement.lift-generation - (generation.with-buffer + (////statement.lift-generation + (///generation.with-buffer (do ///.monad [codeT (generate codeS) - codeN+V (generation.define! name codeT)] + codeN+V (///generation.define! name codeT)] (wrap [code//type codeT codeN+V]))))) (def: (definition name ?type codeC) @@ -79,11 +79,11 @@ (Operation anchor expression statement [Type expression Text Any]))) (do ///.monad [state (//.lift ///.get-state) - #let [analyse (get@ [#statement.analysis #statement.phase] state) - synthesize (get@ [#statement.synthesis #statement.phase] state) - generate (get@ [#statement.generation #statement.phase] state)] - [_ code//type codeA] (statement.lift-analysis - (analysis.with-scope + #let [analyse (get@ [#////statement.analysis #////statement.phase] state) + synthesize (get@ [#////statement.synthesis #////statement.phase] state) + generate (get@ [#////statement.generation #////statement.phase] state)] + [_ code//type codeA] (////statement.lift-analysis + (////analysis.with-scope (type.with-fresh-env (case ?type (#.Some type) @@ -98,7 +98,7 @@ code//type (type.with-env (check.clean code//type))] (wrap [code//type codeA])))))) - codeS (statement.lift-synthesis + codeS (////statement.lift-synthesis (synthesize codeA))] (definition' generate name code//type codeS))) @@ -106,7 +106,7 @@ (All [anchor expression statement] (-> Text Type Code Any (Operation anchor expression statement Any))) - (statement.lift-analysis + (////statement.lift-analysis (do ///.monad [_ (module.define short-name [type annotations value])] (if (macro.type? annotations) @@ -124,7 +124,7 @@ (case inputsC+ (^ (list [_ (#.Identifier ["" short-name])] valueC annotationsC)) (do ///.monad - [current-module (statement.lift-analysis + [current-module (////statement.lift-analysis (//.lift macro.current-module-name)) #let [full-name [current-module short-name]] [_ annotationsT annotationsV] (evaluate! Code annotationsC) @@ -136,14 +136,14 @@ valueC) _ (..define short-name value//type annotationsV valueV) #let [_ (log! (format "Definition " (%name full-name)))]] - (statement.lift-generation - (generation.learn full-name valueN))) + (////statement.lift-generation + (///generation.learn full-name valueN))) _ (///.throw //.invalid-syntax [extension-name])))) (def: (alias! alias def-name) - (-> Text Name (analysis.Operation Any)) + (-> Text Name (////analysis.Operation Any)) (do ///.monad [definition (//.lift (macro.find-def def-name))] (module.define alias definition))) @@ -155,7 +155,7 @@ (^ (list annotationsC)) (do ///.monad [[_ annotationsT annotationsV] (evaluate! Code annotationsC) - _ (statement.lift-analysis + _ (////statement.lift-analysis (module.set-annotations (:coerce Code annotationsV)))] (wrap [])) @@ -168,8 +168,8 @@ (case inputsC+ (^ (list [_ (#.Identifier ["" alias])] [_ (#.Identifier def-name)])) (//.lift - (///.sub [(get@ [#statement.analysis #statement.state]) - (set@ [#statement.analysis #statement.state])] + (///.sub [(get@ [#////statement.analysis #////statement.state]) + (set@ [#////statement.analysis #////statement.state])] (alias! alias def-name))) _ @@ -199,16 +199,16 @@ _ (///.throw //.invalid-syntax [extension-name]))))] - [def::analysis analysis.Handler statement.lift-analysis] - [def::synthesis synthesis.Handler statement.lift-synthesis] - [def::generation (generation.Handler anchor expression statement) statement.lift-generation] - [def::statement (statement.Handler anchor expression statement) (<|)] + [def::analysis ////analysis.Handler ////statement.lift-analysis] + [def::synthesis ////synthesis.Handler ////statement.lift-synthesis] + [def::generation (///generation.Handler anchor expression statement) ////statement.lift-generation] + [def::statement (////statement.Handler anchor expression statement) (<|)] ) (def: bundle::def Bundle - (<| (bundle.prefix "def") - (|> bundle.empty + (<| (//bundle.prefix "def") + (|> //bundle.empty (dictionary.put "module" def::module) (dictionary.put "alias" def::alias) (dictionary.put "analysis" def::analysis) @@ -219,7 +219,7 @@ (def: #export bundle Bundle - (<| (bundle.prefix "lux") - (|> bundle.empty + (<| (//bundle.prefix "lux") + (|> //bundle.empty (dictionary.put "def" lux::def) (dictionary.merge ..bundle::def)))) |