Skip to content

Commit 4acdf5b

Browse files
committed
[stmt.do] add grammar equivalence and reorder paragraphs
1 parent a272b7c commit 4acdf5b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

source/statements.tex

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,25 @@
595595
\indextext{statement!\idxcode{do}}
596596

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

601602
\pnum
602-
In the \keyword{do} statement the substatement is executed repeatedly
603-
until the value of the expression becomes \tcode{false}. The test takes
604-
place after each execution of the statement.
603+
The \keyword{do} statement
604+
\begin{ncsimplebnf}
605+
\keyword{do} statement \keyword{while} \terminal{(} expression \terminal{)} \terminal{;}
606+
\end{ncsimplebnf}
607+
is equivalent to
608+
\begin{ncsimplebnf}
609+
\exposid{label} \terminal{:}\br
610+
\terminal{\{}\br
611+
\bnfindent \terminal{\{} statement \terminal{\}}\br
612+
\bnfindent \keyword{if} \terminal{(} expression \terminal{)} \terminal{\{}\br
613+
\bnfindent \bnfindent \keyword{goto} \exposid{label} \terminal{;}\br
614+
\bnfindent \terminal{\}}\br
615+
\terminal{\}}
616+
\end{ncsimplebnf}
605617

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

0 commit comments

Comments
 (0)