aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/parsing.md7
-rw-r--r--doc/tutorial.md11
2 files changed, 12 insertions, 6 deletions
diff --git a/doc/parsing.md b/doc/parsing.md
index 8c62ea3..d2a7801 100644
--- a/doc/parsing.md
+++ b/doc/parsing.md
@@ -2,7 +2,7 @@ Parsing
=======
Elymas has a very simplistic parser (if at all). Parsing works as follows:
-* Spaces separates things.
+* Spaces separate things.
* If a `#` is encountered, ignore rest of line. This implements comments.
* If a sequence of digits is encountered, this is an integer literal and gets
pushed to the stack.
@@ -23,3 +23,8 @@ Elymas has a very simplistic parser (if at all). Parsing works as follows:
non-alphanumeric prefix is looked up in the current scope. This is how
`/abc` becomes `"abc"`: The string is created during parsing and afterwards
the identity function is applied.
+
+Additionally, the parser has a quote-level counter which is increased by `{`
+and decreased by `}`. If the quote-level is non-zero, i.e. the parser is in
+quote mode, the resolution of names is postponed and a function object doing
+the resolution is pushed instead.
diff --git a/doc/tutorial.md b/doc/tutorial.md
index b491939..24615b4 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -21,7 +21,7 @@ This should result in various executables. For the remainder of this tutorial, j
as it comes with all libraries preloaded. Start it and enter
- "Hello World!" dump
+ "Hello World!" dump
this should yield the obvious result or a bug report to the author.
@@ -75,9 +75,9 @@ Strings can contain some escapes using backslash.
Function objects
----------------
-Multiple functions (and constants) can be combined into one by enclosing them in braces.
-The resulting objects reside on the stack just like all other values. The function `*`
-executes such function objects.
+Multiple functions (and constants) can be combined into one function by enclosing them
+in braces. The resulting objects reside on the stack just like all other values.
+The function `*` executes such function objects.
{ 5 add } dump
<function: 00006000005E0360>
@@ -102,7 +102,7 @@ Scopes
------
Variables live in scopes which are hierarchically nested. Every scope has a parent scope,
-except the topmost and global scope. If a variable is not found in a scope, it's parent is
+except the topmost (global) scope. If a variable is not found in a scope, its parent is
queried for it. Every function object execution creates a fresh scope, in effect allowing
local variables.
@@ -161,3 +161,4 @@ Recommended reading order
-------------------------
* parsing.md - how the input gets interpreted
+* scopes.md - where variables live