© 1989 by British Computer Society
Two-level Grammar as a Functional Programming Language
1 Software Leverage, Inc., 485 Massachusetts Avenue, Arlington, Massachusetts, U.S.A. 02174., 2 Department of Computer and Information Sciences, The University of Alabama at Birmingham, Birmingham, Alabama, USA 35294
A two-level grammar consists of two context-free grammars interacting in a manner such that their combined computing power is equivalent to that of a Turing Machine. We show that two-level grammar can be used as a functional programming where the two-level grammar notation is the syntax of the language. Two-level grammar programs as represented are actually high-level descriptions of recursive functions, with one level of the grammar specifying the function domains and the second level defining the function evaluation rules. A general algorithm to interpret two-level grammars is given to make two-level grammar programs executable. The primary advantages of two-level grammar over other functional programming languages are (1) the capability for data and procedural abstraction provided by the different levels of the grammar and (2) the structured form of natural language which is used as the two-level grammar syntax, making two-level grammar programs very readable.
Received July 1986. revised September 1987.
* Present address: Software Leverage, Inc., 485 Massachusetts Avenue, Arlington, Massachusetts, U.S.A. 02174.
Department of Computer and Information Sciences, The University of Alabama at Birmingham, Birmingham, Alabama, U.S.A. 35294