Nested constructs should technically use a suffix or prefix notation to indicate how they are nested. A prefix (where the deeper structure is named first) is easier to read, as the first part of the label shows the meaning of the label. However, a suffix is more natural, especially to people who are used to C/C++ programming.
Using the suffix method,
transforms to
The following represents the same logic, but using the prefix method (nested structure named first):
Note that the “sequence number” of each nesting can restart from 1 because the prefix or suffix of the parent structure makes it unique.
An alternative (to more experienced programmers) is to simply use sequential numbers for each construct. As one construct is converted, simply pick the next available sequential number. This method requires that the programmer only perform the translation of one construct at a time. Furthermore, the label names no longer reflect the nested structure of the code.