diff options
author | Camil Staps | 2016-04-29 16:43:56 +0200 |
---|---|---|
committer | Camil Staps | 2016-04-29 16:43:56 +0200 |
commit | 7a3c4ff99a9c4d59c201926ac75228f8e8bd3c90 (patch) | |
tree | c099ab89ecaa1f76a313d7b45e9cc31059647bd2 /rulesquotify.tex | |
parent | quotify (diff) |
Cat en Quotify
Diffstat (limited to 'rulesquotify.tex')
-rw-r--r-- | rulesquotify.tex | 28 |
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 +$$ |