summaryrefslogtreecommitdiff
path: root/defio.tex
diff options
context:
space:
mode:
authorCamil Staps2016-05-23 21:47:58 +0200
committerCamil Staps2016-05-23 21:47:58 +0200
commitd0843d062309efffde384c31c5de2d844f886781 (patch)
tree67c25d4a1e2a80bac50fcd0183869ba17a1aea49 /defio.tex
parentKleine tekstuele wijzigingen (diff)
Feedback: metavariabelen; duidelijkheid; formatting
Diffstat (limited to 'defio.tex')
-rw-r--r--defio.tex9
1 files changed, 5 insertions, 4 deletions
diff --git a/defio.tex b/defio.tex
index 4e61ac5..28fc732 100644
--- a/defio.tex
+++ b/defio.tex
@@ -6,17 +6,18 @@ Allereerst definiƫren we het type $\Stack{a}$, omdat stacks we veel met stacks
doen in onze semantiek regels. Een $\Stack{a}$ (lees: een stack van elementen
van type $a$) is een simpel datatype met de volgende syntax:
+\def\inbrackets#1{$\mathrm{[}#1\mathrm{]}$}
+\def\bracka{\inbrackets{a}}
\begin{grammar}
- <Stack[a]> ::= [<a>:<Stack[a]>] | `Nil'
- %todo formatting
+ <Stack \bracka> ::= [<a>:<Stack \bracka>] | `Nil'
\end{grammar}
Op een stack zijn twee instructies gedefinieerd:
\begin{gather*}
\pushop : a \times \Stack{a} \to \Stack{a} \\
- \push{e}{s} \isdef [e:s] \\[1em]
+ \push{e}{\stk} \isdef [e:\stk] \\[1em]
\popop : \Stack{a} \hookrightarrow a \times \Stack{a} \\
- \pop{[e:s]} \isdef (e,s) \\
+ \pop{[e:\stk]} \isdef (e,\stk) \\
\end{gather*}
$\popop$ is een partiƫle functie omdat $\pop\Nil$ niet gebruikt mag worden in