Skip to content

Commit

Permalink
[stmt.do] add grammar equivalence and reorder paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisenwave committed Aug 21, 2023
1 parent a272b7c commit 4acdf5b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions source/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,25 @@
\indextext{statement!\idxcode{do}}

\pnum
The expression is contextually converted to \tcode{bool}\iref{conv};
if that conversion is ill-formed, the program is ill-formed.
In the \keyword{do} statement the substatement is executed repeatedly
until the value of the \grammarterm{expression} becomes \tcode{false}.
The test takes place after each execution of the statement.

\pnum
In the \keyword{do} statement the substatement is executed repeatedly
until the value of the expression becomes \tcode{false}. The test takes
place after each execution of the statement.
The \keyword{do} statement
\begin{ncsimplebnf}
\keyword{do} statement \keyword{while} \terminal{(} expression \terminal{)} \terminal{;}
\end{ncsimplebnf}
is equivalent to
\begin{ncsimplebnf}
\exposid{label} \terminal{:}\br
\terminal{\{}\br
\bnfindent \terminal{\{} statement \terminal{\}}\br
\bnfindent \keyword{if} \terminal{(} expression \terminal{)} \terminal{\{}\br
\bnfindent \bnfindent \keyword{goto} \exposid{label} \terminal{;}\br
\bnfindent \terminal{\}}\br
\terminal{\}}
\end{ncsimplebnf}

\rSec2[stmt.for]{The \tcode{for} statement}%
\indextext{statement!\idxcode{for}}
Expand Down

0 comments on commit 4acdf5b

Please sign in to comment.