summaryrefslogtreecommitdiff
path: root/rulesquotify.tex
diff options
context:
space:
mode:
authorCamil Staps2016-04-29 16:43:56 +0200
committerCamil Staps2016-04-29 16:43:56 +0200
commit7a3c4ff99a9c4d59c201926ac75228f8e8bd3c90 (patch)
treec099ab89ecaa1f76a313d7b45e9cc31059647bd2 /rulesquotify.tex
parentquotify (diff)
Cat en Quotify
Diffstat (limited to 'rulesquotify.tex')
-rw-r--r--rulesquotify.tex28
1 files changed, 14 insertions, 14 deletions
diff --git a/rulesquotify.tex b/rulesquotify.tex
index 0c0f09c..d218fd6 100644
--- a/rulesquotify.tex
+++ b/rulesquotify.tex
@@ -3,22 +3,22 @@
\label{sec:rules:quotify}
\begin{quote}
-q - "Quotifies" the string on top of the stack, so that it can be placed
- into a Smurf program as a literal string, eg
- Arthur "two-sheds" Jackson
- becomes
- "Arthur $\backslash$ "two-sheds $\backslash$ " Jackson"
+ q - "Quotifies" the string on top of the stack, so that it can be placed into
+ a Smurf program as a literal string, eg \texttt{Arthur "two-sheds" Jackson}
+ becomes \texttt{"Arthur $\backslash$"two-sheds$\backslash$" Jackson"}.
\end{quote}
-Er worden dus quotes om de string heen gezet. Als er in de oorspronkelijke string quotes stonden dan wordt voor iedere van deze quotes een "$\backslash$" geplaats.
-Om de backslashes te zetten word gebruik gemaakt van de hulpfunctie quo
+Er worden aanhalingstekens om de string bovenop de stack gezet. Als er in de
+oorspronkelijke string aanhalingstekens, backslashes of LF-karakters staan, dan
+wordt hier een \verb$\$ voor geplaatst. Hiervoor gebruiken we de hulpfunctie
+$\escapeop$.
Dit geeft de volgende regel:
$$
\begin{prooftree}
\trans
- {\pgm}{\ip}{(\push{"quo (c s)"}{\stk'}, \str) }
+ {\pgm}{\ip}{(\push{\texttt{"}\escape{s}\texttt{"}}{\stk'}, \str) }
{\ip}{\op}{\st}
\justifies
\trans
@@ -26,15 +26,15 @@ $$
{\ip}{\op}{\st}
\using{\rquotifyns}
\qquad
- \text{met (c s, stk') = pop (stk)
- }
+ \text{met $(s, stk') = \pop{\stk}$.}
\end{prooftree}
$$
$$
- \quo {c} {s} =
+ \escape{c~s} =
\begin{cases}
- \texttt{" c quo s} & \text{als $c=\texttt{"}$} \\
- \texttt{c quo s} & \text{anderszins}
+ \texttt{\textbackslash}~c~s & \text{als
+ $c\in\{\texttt{"},\texttt{\textbackslash},\text{het LF-karakter}\}$} \\
+ c~\escape{s} & \text{anderszins}
\end{cases}
-$$ \ No newline at end of file
+$$