Implementation [of finite automata for nested patterns]
Given the rules for a substitution system in the form used on page 931 a finite automaton (as on page 957) which yields the color of each cell from the digit sequences of its position is
Map[Flatten[MapIndexed[#2 - 1 Position[rules, #1 _]〚1, 1〛 &, Last[#], {-1}]] &, rules]
This works in any number of dimensions so long as each replacement yields a block of the same cuboidal form.