Head-Driven Generation and Indexing in ALE

We present a method for compiling grammars into efficient code for head-driven generation in ALE. Like other compilation techniques already used in ALE, this method integrates ALE's compiled code for logical operations with control-specific information from (SNMP90)'s algorithm along with user-defined directives to identify semantics-related substructures. This combination provides far better performance than typical bi-directional featurebased parser/generators, while requiring a minimum of adjustment to the grammar signature itself, and a minimum of extra compilation. 1 M o t i v a t i o n Large-scale development systems for typed feature~ based grammars have typically oriented themselves towards parsing, either ignoring generation entirely (the usual case), or assuming that generation can be achieved for free by using a bi-directional control strategy with a semantically, rather than phonologically, instantiated query. In the latter case, the result has inevitably been a system which is unacceptably slow in both directions. At the same time, several lower-level logical operations over typed feature structures, such as inferring a type from the existence of an appropriate feature, or the unification of two feature structures, are indeed common to both parsing and generation; and generators outside this logical domain, of course, can make no use of them. What is required is a system which provides a common pool of these operations optimized for this particular logic, while also providing modes of processing which are suited to the task at hand, namely parsing or generation. This is exactly how the situation has developed in other areas of logic programming. The Warren Abstract Machine and its various enhancements are now the de facto standard for Prolog compilation, for example; and with that standard come techniques for call stack management, heap data structures etc.; but this does not mean that all Prolog programs are created equal the more sophisticated compilers use mode declarations in order to optimize particular programs to being called with certain argument instantiations. The Attribute Logic Engine (ALE,(CP94)) is a logic programming language based on typed feature structures, which can compile common logical operations like type inferencing and unification into efficient lower-level code. ALE also compiles grammars themselves into lower-level instructions, rather than simply running an interpreter over them, which yields a substantial increase in efficiency. For ALE, the question of efficient generation is then how to compile grammars for use in semanticallyinstantiated queries. To date, however, ALE has fallen within the class of systems which have ignored generation entirely. Its only control strategies have been a built-in bottom-up chart parser, and the usual SLD-resolution strategy for its Prolog-like language. On the other hand, only a few of the operations it compiles are specific to the parsing direction. ALE's lower level of instructions are expressed using Prolog itself as the intermediate code. ALE compiles the various elements of a typed feature-based grammar (type signature, feature declarations, lexical rules, phrase structure-like grammar rules) into Prolog clauses which are then compiled further by a Prolog compiler for use at run-time. In fact, ALE also has a Prolog-like logic programming language of its own, based on typed feature structures. Goals from this language can be used as procedural attachments on lexical rules or grammar rules as well.