summaryrefslogtreecommitdiff
path: root/rulestail.tex
blob: dc93a3b7d2d6324cdefe8c40bd449cb3321e75b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
% vim: set spelllang=nl:
\subsection{\texttt{Tail}}
\label{sec:rules:tail}

\begin{quote}
    t - Pops a string from the stack, and pushes its tail, ie all but the first character. This causes an error if used on the empty string.
\end{quote}

In plaats van het geven van een error kiezen we ervoor te voorkomen dat we een
afleidingsboom kunnen maken wanneer $\StmTail$ wordt uitgevoerd op het moment
dat het element bovenop de stack de lege string is.

Dit geeft de volgende regel:

$$
\begin{prooftree}
	\trans
		{\pgm}{\ip}{(\push{s}{\stk'}, \str)}
		{\ip'}{\op}{\st}
	\justifies
	\trans
		{\StmTail:\pgm}{\ip}{(\stk,\str)}
		{\ip'}{\op}{\st}
	\using{\rtailns}
	\qquad
	\text{met $ \pop{\stk} = (c~s,\stk') $.}
\end{prooftree}
$$