| Massaging Grammars |
| < stmt > |
| if < expr > then < stmt > end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | | if < expr > then < stmt > else < stmt > end | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < stmt > |
| if < expr > then < stmt > < iftail > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < iftail > |
| else < stmt > end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | | end | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A alpha) is
fatal in a top-down parser because if the parser chooses to
apply such a rule once it will do so indefinitely
.
alpha A) is
undesirable (i.e. I better not see any in your parsers) in a
bottom up parser because it may lead to overflow in the parser's
stack.
| < slist > |
| < stmt > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | | < stmt > ; < slist > | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < slist > |
| < stmt > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | | < slist > ; < stmt > | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This grammar:
| Massaging Grammars |