update wiskundige functies
[sec1415.git] / syntax.tex
1 \subsection{Originele Syntax}
2 De ware syntax voor piet is makkelijk te beschrijven in een zeer grote tabel
3 die gedeeltelijk beschreven is in tabel \ref{tab:sy1}.
4 \begin{table}[h]
5 \caption{Gedeeltelijke ware syntax van \textit{Piet}}
6 \label{tab:sy1}
7 \begin{tabular}{l|cccccc} %p{1em}|p{1em}p{1em}p{1em}p{1em}p{1em}p{1em}p{1em}}
8 \textbackslash & {\color{lred}\#} & {\color{lyellow}\#} &
9 {\color{lgreen}\#}& {\color{lcyan}\#} &
10 {\color{lblue}\#} & ...\\
11 \hline
12 {\color{lred}\#} & - & inc & dup & gre & ... & ...\\
13 {\color{lyellow}\#} & add & - & inc & dup & ... & ...\\
14 {\color{lgreen}\#} & div & add & - & inc & ... & ...\\
15 {\color{lcyan}\#} & gre & div & add & - & ... & ...\\
16 {\color{lblue}\#} & dup & gre & div & add & ... & ...\\
17 {\color{lmagenta}\#} & inc & dup & gre & div & ... & ...\\
18 {\color{red}\#} & pus & oun & rol & ... & ... & ...\\
19 {\color{yellow}\#} & sub & pus & oun & ... & ... & ...\\
20 {\color{green}\#} & mod & sub & pus & ... & ... & ...\\
21 {\color{cyan}\#} & poi & mod & sub & ... & ... & ...\\
22 {\color{blue}\#} & rol & poi & mod & ... & ... & ...\\
23 {\color{magenta}\#} & oun & rol & poi & ... & ... & ...\\
24 {\color{dred}\#} & pop & ouc & ouc & ... & ... & ...\\
25 {\color{dyellow}\#} & mul & pop & ouc & ... & ... & ...\\
26 {\color{dgreen}\#} & not & mul & pop & ... & ... & ...\\
27 {\color{dcyan}\#} & swi & not & mul & ... & ... & ...\\
28 {\color{dblue}\#} & inn & swi & not & ... & ... & ...\\
29 {\color{dmagenta}\#} & ouc & ouc & swi & ... & ... & ...\\
30 {\color{black}\#} & blo & blo & blo & ... & ... & ...\\
31 {\color{white}\#} & ski & ski & ski & ... & ... & ...\\
32 \end{tabular}
33 \end{table}
34
35 \subsection{Tussentaal}
36 Om de notatie leesbaar en overzichtelijk te houden beschrijven we de syntax
37 niet in de oorspronkelijke kleuren notatie maar gebruiken we een woordelijke
38 notatie. Dan ziet de grammatica er als volgt uit:\\
39 $S ::= S_1 ; S_2\ |\ push \: n\ |\ pop\ |\ add\ |\ subtract\
40 |\ multiply\ |\ divide\ |\\mod\ |\ not\ |\ greater\
41 |\ pointer\ |\ switch\ |\ duplicate\ |\ roll\ |\\
42 inchar\ |\ innum\ |\ outchar\ |\ outnum$\\
43
44 Waarbij $n \in \mathbb{N}_1$.