From 6e7015f0efc19c993e7c48d5be49924b0e0569a4 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 19 May 2016 16:52:31 +0200 Subject: Update example program --- paper/intro-while.tex | 11 +++++------ paper/while.sty | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'paper') 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}} -- cgit v1.2.3