Grammars as Software Libraries


A Ranta, . 6 décembre 2006 09:00 limd 2:00:00
Abstract:

Libraries are a major instrument of software engineering, making it possible to reuse code and to distribute labour between programmers with different areas of expertise. The sophisticated application programs we have today would not be possible without huge libraries in areas such as data structures, numerical analysis, signal processing, and computer graphics. Grammars of natural languages are a domain of a lot of expert knowledge, which it would be useful to find in software libraries. However, typical implementations of grammars are monolithic application programs, such as parsers tuned to a particular corpus. New applications typically have to build their grammars from scratch, which makes it costly to build programs such as natural-language interfaces, or to perform high-quality software localization. This talk presents an approach where grammars can be used as libraries for new grammars and for programs that involve natural language components. The approach is implemented in GF (Grammatical Framework), which is a special-purpose functional programming language for writing grammars. Several features of GF are used in an essential way: the division between abstract and concrete syntax; the module system, including parametrized modules; the type system, which is able to enforce grammar checking via type checking; and code generation that makes GF grammars usable in other programming languages, such as C, Haskell, and Java. To bring the discussion to concrete level, we introduce the GF Resource Grammar Library, which implements the basic grammars of ten languages and makes them accessible to non-linguist application programmers. As an application, we show how the library can be used in building a natural-language interface to a proof system.