It is difficult to provide rules with substantial actions
and still have a readable specification file.
Here are a few style hints:
Use all uppercase letters for token names and all lowercase letters for
This helps in debugging.
Preface token names with an unusual sequence of characters, such as
t_, to ensure that there are no conflicts with C reserved
Put grammar rules and actions on separate lines to make
the specification easier to read and edit.
Put all rules with the same left side together.
The left side should appear only once and
each rule after the first one should begin with a vertical bar.
Put the semicolon on a separate line after the last rule.
This allows new rules to be added easily.
Indent the body of a rule by one tab stop and the body of an
action by two tab stops.
Put complicated actions into subroutines.
Hints for preparing specifications
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003