From 288727f09a1b3458c268497d111349e608c3f9fa Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Tue, 2 Aug 2022 01:20:12 +0200 Subject: init --- docs/env.rst | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/env.rst (limited to 'docs/env.rst') diff --git a/docs/env.rst b/docs/env.rst new file mode 100644 index 0000000..5a4a243 --- /dev/null +++ b/docs/env.rst @@ -0,0 +1,34 @@ +Environment +=========== + +Environment (not to be mixed with context) represent current state of +interpreter instance. It contains reference to memory, input stream and +output stream. To enable +`tail call optimization `_, +environment is also used as storage for next expression evaluation. + +Main method responsible for environment evaluation is `lsp_env_resolve`. +This function implements evaluation loop (also known as trampoline), which +iteratively evaluates sequence of expressions. Evaluation of single expression +can result in direct data value (which is registered with +`lsp_env_set_result_value` function) or can be delegated to execution +of another expression (which is registered with `lsp_env_set_result_eval` +function). Evaluation loop (trampoline) repeats expression evaluation +until resulting data value is fully resolved. + + +Source code +----------- + +env.h +''''' + +.. literalinclude:: ../src_c/env.h + :language: c + + +env.c +''''' + +.. literalinclude:: ../src_c/env.c + :language: c -- cgit v1.2.3-70-g09d2