An automaton is defined which goes through a certain number of states. The states are named by indices. The sequence of permitted states is defined by a grammar that handles strings of states.
Axioms define the string of initial states. In this case 0.
Productions or production rules allow the rewriting (through substitution) of certain states. Thus 0 may be rewritten 0 1 5 0.
To each defined state of the automaton a vector is attached which refers to the action to carry out : rotate ( as mentioned by the orientation of the vector ), and move forward some length ( as expressed by the magnitude of the vector ). The action may be visible ( a segment is drawn ) or not ( the pen simply moves ).