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
non-terminal names.
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
words.
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.