diff options
Diffstat (limited to 'stdlib/source/library/lux/tool/interpreter.lux')
-rw-r--r-- | stdlib/source/library/lux/tool/interpreter.lux | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index ed08ed73f..c6e9c5de3 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -16,7 +16,7 @@ ["[0]" module] ["[0]" type]] ["[0]" generation] - ["[0]" directive (.only State+ Operation) + ["[0]" declaration (.only State+ Operation) ["[0]" total]] ["[0]" extension]] ["[0]" default @@ -58,26 +58,26 @@ "Till next time...") (def enter_module - (All (_ anchor expression directive) - (Operation anchor expression directive Any)) - (directive.lifted_analysis + (All (_ anchor expression declaration) + (Operation anchor expression declaration Any)) + (declaration.lifted_analysis (do phase.monad [_ (module.create 0 ..module)] (analysis.set_current_module ..module)))) (def (initialize Monad<!> Console<!> platform configuration generation_bundle) - (All (_ ! anchor expression directive) + (All (_ ! anchor expression declaration) (-> (Monad !) - (Console !) (Platform ! anchor expression directive) + (Console !) (Platform ! anchor expression declaration) Configuration - (generation.Bundle anchor expression directive) - (! (State+ anchor expression directive)))) + (generation.Bundle anchor expression declaration) + (! (State+ anchor expression declaration)))) (do Monad<!> [state (platform.initialize platform generation_bundle) state (platform.compile platform (has cli.#module syntax.prelude configuration) (has [extension.#state - directive.#analysis directive.#state + declaration.#analysis declaration.#state extension.#state .#info .#mode] {.#Interpreter} @@ -87,10 +87,10 @@ _ (at Console<!> write ..welcome_message)] (in state))) -(with_expansions [<Interpretation> (these (Operation anchor expression directive [Type Any]))] +(with_expansions [<Interpretation> (these (Operation anchor expression declaration [Type Any]))] - (def (interpret_directive code) - (All (_ anchor expression directive) + (def (interpret_declaration code) + (All (_ anchor expression declaration) (-> Code <Interpretation>)) (do phase.monad [_ (total.phase code) @@ -98,14 +98,14 @@ (in [Any []]))) (def (interpret_expression code) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Code <Interpretation>)) (do [! phase.monad] [state (extension.lifted phase.state) - .let [analyse (the [directive.#analysis directive.#phase] state) - synthesize (the [directive.#synthesis directive.#phase] state) - generate (the [directive.#generation directive.#phase] state)] - [_ codeT codeA] (directive.lifted_analysis + .let [analyse (the [declaration.#analysis declaration.#phase] state) + synthesize (the [declaration.#synthesis declaration.#phase] state) + generate (the [declaration.#generation declaration.#phase] state)] + [_ codeT codeA] (declaration.lifted_analysis (analysis.with_scope (type.with_fresh_env (do ! @@ -114,9 +114,9 @@ codeT (type.with_env (check.clean codeT))] (in [codeT codeA]))))) - codeS (directive.lifted_synthesis + codeS (declaration.lifted_synthesis (synthesize codeA))] - (directive.lifted_generation + (declaration.lifted_generation (generation.with_buffer (do ! [codeH (generate codeS) @@ -125,23 +125,23 @@ (in [codeT codeV])))))) (def (interpret configuration code) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> Configuration Code <Interpretation>)) (function (_ state) (case (<| (phase.result' state) - (sharing [anchor expression directive] - (is (State+ anchor expression directive) + (sharing [anchor expression declaration] + (is (State+ anchor expression declaration) state) (is <Interpretation> - (interpret_directive code)))) + (interpret_declaration code)))) {try.#Success [state' output]} {try.#Success [state' output]} {try.#Failure error} - (if (ex.match? total.not_a_directive error) + (if (ex.match? total.not_a_declaration error) (<| (phase.result' state) - (sharing [anchor expression directive] - (is (State+ anchor expression directive) + (sharing [anchor expression declaration] + (is (State+ anchor expression declaration) state) (is <Interpretation> (interpret_expression code)))) @@ -149,43 +149,43 @@ ) (def (execute configuration code) - (All (_ anchor expression directive) - (-> Configuration Code (Operation anchor expression directive Text))) + (All (_ anchor expression declaration) + (-> Configuration Code (Operation anchor expression declaration Text))) (do phase.monad [[codeT codeV] (interpret configuration code) state phase.state] (in (/type.represent (the [extension.#state - directive.#analysis directive.#state + declaration.#analysis declaration.#state extension.#state] state) codeT codeV)))) -(type (Context anchor expression directive) +(type (Context anchor expression declaration) (Record [#configuration Configuration - #state (State+ anchor expression directive) + #state (State+ anchor expression declaration) #source Source])) -(with_expansions [<Context> (these (Context anchor expression directive))] +(with_expansions [<Context> (these (Context anchor expression declaration))] (def (read_eval_print context) - (All (_ anchor expression directive) + (All (_ anchor expression declaration) (-> <Context> (Try [<Context> Text]))) (do try.monad [.let [[_where _offset _code] (the #source context)] [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (the #source context)) [state' representation] (let [... TODO: Simplify ASAP - state (sharing [anchor expression directive] + state (sharing [anchor expression declaration] (is <Context> context) - (is (State+ anchor expression directive) + (is (State+ anchor expression declaration) (the #state context)))] (<| (phase.result' state) ... TODO: Simplify ASAP - (sharing [anchor expression directive] + (sharing [anchor expression declaration] (is <Context> context) - (is (Operation anchor expression directive Text) + (is (Operation anchor expression declaration Text) (execute (the #configuration context) input)))))] (in [(|> context (has #state state') @@ -193,11 +193,11 @@ representation])))) (def .public (run! Monad<!> Console<!> platform configuration generation_bundle) - (All (_ ! anchor expression directive) + (All (_ ! anchor expression declaration) (-> (Monad !) - (Console !) (Platform ! anchor expression directive) + (Console !) (Platform ! anchor expression declaration) Configuration - (generation.Bundle anchor expression directive) + (generation.Bundle anchor expression declaration) (! Any))) (do [! Monad<!>] [state (initialize Monad<!> Console<!> platform configuration)] |