This paper discusses the derivation of functional programs for grammar analysis problems, such as the Empty problem and the Reachable problem. Grammar analysis problems can be divided into two classes: top-down problems such as Follow and Reachable, which are described in terms of the contexts of nonterminals, and bottom-up problems such as Empty and First, which do not refer to contexts. In a previous paper we derive a program for bottom-up grammar analysis problems. In this paper we derive a program for top-down grammar analysis problems by transforming the speci cation of an arbitrary top-down problem into a program. The existence of a solution is guaranteed provided some natural conditions are satis ed. Furthermore, we describe a general transformation that applies to both classes of grammar analysis problems. The result of this transformation is a program that avoids unnecessary computations in the computation of a xed point. Constructor classes, e used to abstract from the notio...
Johan Jeuring, S. Doaitse Swierstra