It is difficult to provide rules with substantial actions and still have a readable specification file. The following style hints owe much to Brian Kernighan.
a. Use all capital letters for token names, all lower case letters for nonterminal names. This rule comes under the heading of ``knowing who to blame when things go wrong.''
b. Put grammar rules and actions on separate lines. This allows either to be changed without an automatic need to change the other.
c. Put all rules with the same left hand side together. Put the left hand side in only once, and let all following rules begin with a vertical bar.
d. Put a semicolon only after the last rule with a given left hand side, and put the semicolon on a separate line. This allows new rules to be easily added.
e. Indent rule bodies by two tab stops, and action bodies by three tab stops.
The example in Appendix A is written following this style, as are the examples in the text of this paper (where space permits). The user must make up his own mind about these stylistic questions; the central problem, however, is to make the rules visible through the morass of action code.