Rule groups can be nested. Instead of a predicate in a rule test also a rule groups is allowed. The semantics is that after the (in specification order) last predicate the rule group is evaluated, and then the rule test continues. Thus nested rule groups are generated in the target code at the same place where target predicates are generated.
Nested rule groups can be used to factor out common rule parts. The following rule group with two rules
is equivalent to the following consisting of a nested rule group with rule nesting:
The difference, however, is speed:
the loops over LinearBlocks(P,B), Stmts(B,S), Expr(S,E)
are generated twice inthe first example, and once in the
second.