Sometimes, a language design will include syntactic constraints that are better handled outside the formalism of a context-free grammar, even though the grammar can handle them. Consider, for example, the following "check off" keyword scheme:
with the restrictions that α-keyword, β-keyword, γ-keyword, δ-keyword, and ζ-keyword appear in order, and that each of them appear at most once.
(a) Since the set of combinations is finite, it can clearly be encoded into a series of productions. Give one such grammar.
(b) Propose a mechanism using ad hoc syntax-directed translation to achieve the same result.
(c) A simpler encoding, however, can be done using a more permissive grammar and a hard-coded set of checks in the associated actions.
(d) Can you use an _-production to further simply your syntax-directed translation scheme?