The idea of nanopasses strikes me as elegant because it'd be easy to
write and test extensions to a language by inserting new passes. For
instance, I sometimes find myself wanting a BREAK
statement to
immediately exit an occam loop. Since it's possible to rewrite:
WHILE continue.condition
do.something ()
IF
exit.condition
BREAK
TRUE
SKIP
do.something.else ()
as:
INITIAL BOOL foo IS TRUE:
WHILE (continue.condition AND foo)
do.something ()
IF
exit.condition
foo := FALSE
TRUE
do.something.else ()
it would be fairly straightforward to drop in an extra pass to do that
transformation automatically. You could implement CONTINUE
and
RETURN
(with the Python semantics) the same way.
Doing this would offend the single-exit-point purists, of course, but they could always just disable that pass.