Skip to content

Commit bdcc63a

Browse files
committed
elaborate on what well-structured control flow means
1 parent 6030db8 commit bdcc63a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

AstSemantics.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,15 @@ Branches that exit a `block`, `loop`, or `tableswitch` may take a subexpression
250250
that yields a value for the exited construct.
251251
Branches may only reference labels defined by an outer *enclosing construct*.
252252
This means that, for example, references to a `block`'s label can only occur
253-
within the `block`'s body. In practice, outer `block`s can be used to place labels for any
254-
given branching pattern, except for one restriction: one can't branch into the middle of a
255-
loop from outside it. This restriction ensures all control flow graphs are well-structured.
253+
within the `block`'s body.
254+
255+
In practice, outer `block`s can be used to place labels for any given branching
256+
pattern, except for one restriction: one can't branch into the middle of a loop
257+
from outside it. This restriction ensures all control flow graphs are well-structured
258+
in the exact sense as in high-level languages like Java and JavaScript. To
259+
further see the parallel, note that a `br` to a `block`'s label is functionally
260+
equivalent to a labeled `break` in high-level languages in that a `br` simply
261+
breaks out of a `block`.
256262

257263
### Yielding values from control constructs
258264

0 commit comments

Comments
 (0)