summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-05-19 16:52:31 +0200
committerCamil Staps2016-05-19 16:52:31 +0200
commit6e7015f0efc19c993e7c48d5be49924b0e0569a4 (patch)
treeecc6543fd6d0652701dcc0dcec5cc02ee0008d70
parentMinor changes opdracht8 (diff)
Update example program
-rw-r--r--paper/intro-while.tex11
-rw-r--r--paper/while.sty4
2 files changed, 9 insertions, 6 deletions
diff --git a/paper/intro-while.tex b/paper/intro-while.tex
index e35c07a..30d8efd 100644
--- a/paper/intro-while.tex
+++ b/paper/intro-while.tex
@@ -45,16 +45,15 @@ ignore all whitespace, and do not allow variable names that are reserved
keywords such as \whskip.
The semantics of these syntax constructs should be intuitive. As an example,
-after executing the following program \verb$x$ will approximate \verb$y$
-divided by $2$:
+after executing the following program, \verb$y$ will have been divided by $2$:
\begin{while}
\whcomp%
- {\whass{x}{0}}
- {\whwhile{y > 0}%
+ {\whass{x}{y}}
+ {\whwhile{\whnotp{\whle{x}{0}}}%
{\whcomp%
- {x := x + 1}%
- {y := y - 2}%
+ {x := x - 2}%
+ {y := y - 1}%
}
}
\end{while}
diff --git a/paper/while.sty b/paper/while.sty
index 1c61164..33b94b3 100644
--- a/paper/while.sty
+++ b/paper/while.sty
@@ -5,3 +5,7 @@
\def\whcomp#1#2{#1\texttt{;} #2}
\def\whif#1#2#3{\texttt{if #1 then #2 else #3 endif}}
\def\whwhile#1#2{\texttt{while #1 do #2 done}}
+
+\def\whnot#1{\texttt{$\lnot$#1}}
+\def\whnotp#1{\texttt{$\lnot$(#1)}}
+\def\whle#1#2{\texttt{#1 $\le$ #2}}