aboutsummaryrefslogtreecommitdiff
path: root/docs/repl.rst
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2022-08-02 01:20:12 +0200
committerbozo.kopic <bozo@kopic.xyz>2022-09-25 02:40:23 +0200
commit288727f09a1b3458c268497d111349e608c3f9fa (patch)
treed62565249fa3c7127856c65405752572fc41aca9 /docs/repl.rst
Diffstat (limited to 'docs/repl.rst')
-rw-r--r--docs/repl.rst40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/repl.rst b/docs/repl.rst
new file mode 100644
index 0000000..9046781
--- /dev/null
+++ b/docs/repl.rst
@@ -0,0 +1,40 @@
+REPL
+====
+
+REPL, as it's name suggest, is function implementing endless loop with
+following actions:
+
+ * read
+
+ First step is reading data from input stream.
+
+ * evaluate
+
+ Data that was read from input stream represent expression that
+ should be evaluated by interpreter.
+
+ * print
+
+ Once evaluation finishes, result of evaluation is written to
+ output stream. In case resulting data is ``()``, print step is
+ skipped.
+
+This loop is stopped only in case closing of input or output stream is
+detected.
+
+
+Source code
+-----------
+
+repl.h
+''''''
+
+.. literalinclude:: ../src_c/repl.h
+ :language: c
+
+
+repl.c
+''''''
+
+.. literalinclude:: ../src_c/repl.c
+ :language: c