Using Functional Parsing to Achieve Quality
in Software Maintenance
(IFI TR 93.36)
Peter Baumann Jurg Fassler Markus Kiser Zafer Ozturk ?
Institut fur Informatik der Universitat Zurich,
Winterthurerstr. 190, 8057 Zurich, Schweiz
Email: fbaumann,faessler,kiser,[email protected]
Telephone: +41-1-257 4307. Fax: +41-1-363 0035.
Keywords: software maintenance, software quality, functional programming, functional parsing, incremental parsing, Standard ML.
Abstract: Many software maintenance tools rely on a parser. When integrating several maintenance tools into a software maintenance environment, it is useful that all these tools are based on the same flexible parser. In this paper, we present a method of implementing such a parser in a functional way.
A functional parser can be built using basic parsers for the terminal symbols, and nonbasic parser for the non-terminal symbols of a grammar. To create the latter, so-called parser combinators ? implemented as higher-order functions ? are used. It turns out that by using the functional parsing approach, large parts of a parser can in fact be generated automatically.
The resulting functional parser has some very useful features which make it ideal for use in a software maintenance environment. The most important one is that the parser is incremental in its nature, which means that we automatically obtain a parser for every single production of the underlying grammar in EBNF. Moreover, due to this one-to-one correspondence between the parser and the EBNF productions, there is a very clean and consistent way to use the parser as a front-end for tools to be developed on top of it.
We have implemented a functional parser for COBOL 74 in only a few weeks. We will use this parser for all the tools in the software maintenance environment AEMES1 which is currently being developed at the Institut fur Informatik of the University of Zurich.
?Jurg Fassler is supported by KWF (Schweizerische Komission zur Forderung der wissenschaftlichen Forschung), grant nr. 2326.1 Zafer Ozturk is supported by Swiss Life Insurance and Pension Company. 1AEMES stands for "An Extensible Maintenance Engineering System", a software maintenance project whose aim is to integrate a collection of maintenance tools into a consistent environment. This project is supported by KWF , Swiss Life Insurance and Pension Company and Bull .