Using Functional Parsing to Achieve Quality in Software Maintenance

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 exible 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 non-basic 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 AEMES 1 which is currently being developed at the aim is to integrate a collection of maintenance tools into a consistent environment.

[1]  Chris Reade,et al.  Elements of functional programming , 1989, International computer science series.

[2]  Graham Hutton,et al.  Higher-order functions for parsing , 1992, Journal of Functional Programming.

[3]  Hall Chapman,et al.  Software Reuse and Reverse Engineering in Practice , 1992 .

[4]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[5]  Lawrence Charles Paulson,et al.  ML for the working programmer , 1991 .