Hints for yacc
Some useful hints for using yacc:
- Avoid ``empty'' productions; these are likely to generate
grammar conflicts that may be hard to find. Each production should
consume some input.
- Follow the Pascal grammar flowcharts exactly. If you just write
the grammar from your memory of Pascal syntax, it probably won't work.
- When the action code for a production is called, all of
the $i variables have been completely processed and
- If you need to process a list of items of the same kind,
the code for begin is a good model.
- The yacc stack has a single type; for our program,
that type is TOKEN. If you want to return something else
(e.g. a SYMBOL), package it in a TOKEN.