Finite-state Approximation of Constraint-based Grammars using Left-corner Grammar Transforms

This paper describes how to construct a finite-state machine (FSM) approximating a 'unification-based' g rammar using a left-corner g rammar transform. The approximation is presented as a series of grammar transforms, and is exact for leftqinear and rightlinear CFGs, and for trees up to a user-specified depth of center-embedding. 1 I n t r o d u c t i o n This paper describes a method for approximating grammm's with finite-state machines. Unlike the method derived from the LR(k) parsing algor i thm described in Pereira and Wright (1991), these methods use g rammar transformations based on the left-corner g rammar transform (Rosenkrantz and Lewis II, 1970; Aho and Ulhnan, 1972). One advantage of the left, corner methods is that they generalize straightforwardly to complex feature "unification based" grammars , unlike the LR(k) based at> proach. For example, the implementat ion described here translates a DCG version of the example grammar given by Pereira and Wright (1991) directly into a FSM without constructing an approximating CFG. Left-corner based techniques are natural for this kind of application because (with the simple optimization described below) they can parse pure leftbranching or pure right-branching structures with a stack depth of one (two if terminals are pushed and popped from the stack). Higher stack depth occurs with center-embedded structures, which humans find difficult to comprehend. This suggests tha t we may get a finite-state approximation to human performance by simply imposing a stack depth bound. We provide a simple tree-geometric description of the configurations tha t cause an increase ill a left corner parser 's stack depth below. The rest of this paper is structured as follows. The remainder of this section outlines the "grammar transform" approach, summarizes the top-down " This research was suppor ted by NSF grant SBR526978. I began this research while I wins on sabbatical at the Xerox Research Centre in Grenoble, lh-ance. I would like to thank them and my colleages at Brown for their suppor t . t)arsing algorithm and discusses how finite state approximations of top-down parsers can be cons trut ted. The fact that this approximation is not exact for left linear grammars (which define finite-state languages) motivates a finite-state approxinlation based on the left-corner parsing algorithm (which is presented as a g rammar transform in section 2). In its s tandard form the approximation based on the left-corner parsing algorithm suffers from the complementary problem to the toi)-down approximation: it is not exact for right-linear grmnmars, but tile "optimized" variants presented in section 3 overcome this deficiency, resulting in finite-state CFG approximations which m'e exact for leftqinear and right-linear grmnmars. Section 4 discusses how these techniques can be combined in an implementation. 1.1 P a r s i n g s t r a t e g i e s as grammar t r a n s f o r m a t i o n s The parsing algorithms discussed here are presented as grammar trans/ormatioTzs, i.e., functions T that map a context-free g rammar G into another contextfi'ee g rammar T(G). The transforms have the property tha t a top-down parse using the transformed g rammar is isomorphic to some other kind of parse using tile original grammar. Thus g rammar transforms provide a simple, compact way of describing various parsing algorithms, as a top-down parser using T(G) behaves identically to the kind of parser we want to study using G. 1.2 Mappings from trees to trees Tile t ranstbrmations presented here can also be understood as isomorphisms fi'om the set of parse trees of the source g rammar G to parse trees of the transformed grammar which preserve terminal strings. Tiros it is convenient to explain the transforms in terms of their effect on parse trees. We call a parse tree with respect to tile source g rammar G an analysis tree, in order to distinguish it from parse trees with respect to some transform of G. Tile analysis tree t in Figure 1 will be used as an example throughout this paper.