The generation evolving from the regular expression
according to Rule 18 is which can be
simplified slightly to If we calculate
derivatives strictly according to the rules, simplifying only to remove
's (% in the following script) and terms beginning with
's (#'s), we obtain for the first few derivatives

we may draw the conclusion that there are only five distinct
derivatives, one of which is zero, and one of which is a sum. Thus the
following table is sufficient to deduce all the remaining derivatives.

The five distinct derivatives are also the nodes in a diagram
describing the second generation of Rule 18; it is an exit diagram,
whose links are shown in Figure . Comparison with
Figure shows them to be equivalent, although slightly
different.

Figure: Exit diagram for Rule 18.

The right factors will be formed from intersections of these left
derivatives.

It is possible to work out the right derivatives of this same regular
expression; One might think that the results should be the same because
Rule 18 is a symmetrical rule. However, the regular expression
describing it is not, and consequently the remainder of the analysis
must proceed accordingly. We can use the same program to calculate the
derivatives, however, just by reversing the order of the factors:

While different from the exit diagram, it evidently serves the
same purpose. To use an entrance diagram one builds up an expression
from right to left reading backwards along the arrows until an
initial node is reached.