It is difficult to
provide rules with substantial actions
and still have a readable specification file.
The following are a few style hints.
Use all uppercase letters for token names and all lowercase letters for
This is useful in debugging.
Put grammar rules and actions on separate lines.
It makes editing easier.
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.
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.
Indent rule bodies by one tab stop and action bodies by two
Put complicated actions into subroutines defined in separate files.
``A simple example''
is written following this style, as are
the examples in this section (where space permits).
The central problem is to make the rules visible through
the morass of action code.
Hints for preparing specifications
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004