diff options
-rw-r--r-- | sec/compiler.ltx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sec/compiler.ltx b/sec/compiler.ltx index a78a6cd..8f18adc 100644 --- a/sec/compiler.ltx +++ b/sec/compiler.ltx @@ -58,12 +58,13 @@ A parser combinator can interact with state when: \item performing a semantic action (modifying the parse result), where it can read the state. \end{itemize} -For example, consider parsing the syntax \verb|\x => x|, binding the -variable \verb|x| before referencing it. After processing the first -occurrence of \verb|x|, the \lang{} parser updates the state adding -\verb|x| to the environment of bound names. After parsing the second -\verb|x| as an identifier, the parser can look up the name in the -environment and convert it into a deBruijn index. +For example, consider parsing the syntax \systemtinline{\x => x}, +binding the variable \systemtinline{x} before referencing it. After +processing the first occurrence of \systemtinline{x}, the \lang{} +parser updates the state by adding \systemtinline{x} to the +environment of bound names. After parsing the second \systemtinline{x} +as an identifier, the parser can look up the name in the environment +and convert it into a deBruijn index. The state is not stored globally, but is local to the current parser combinator. We can imagine this as a stack of states. Before parsing |