Reusable Parser Generation from Open Source Compilers [chapter]

Kazuaki Maeda
IFIP International Federation for Information Processing  
Many Open Source Software (called OSS) projects have been proposed and many software developers have contributed to develop software by OSS style. In the OSS development style, the source code is opened to the public and checked by the distributed software developers to improve the quality. The source code is, however, not effectively used to improve the productivity of other software development. This paper describes reusable parser generation from the source code of popular open source
more » ... rs. In construction of code analyzers or reverse engineering tools, the parser development is a time-consuming task. To improve the productivity of the task, a renewal parser generator MJay was developed. MJay generates grammar definitions and some utility programs. It is useful to construct software tools to analyze source code. Based on my experiences to construct software tools to generate UML diagrams from source code, there are three approaches to develop the parser. 1. To develop a parser from scratch by reading the programming language specification. It takes about one week to develop the parser from scratch to the best of my knowledge. There are some cases where it takes more than one week to develop it with high quality because the specification of recently popular programming languages is very complex. It is too long to catch up with the short-term development in the current situation as agile software development grows in popularity. 2. To get grammar definitions from major web sites, or find them using web search engines. There are some web sites including collections of public grammar definitions [1]. The collections in the web sites are very useful, but many public grammars contain errors and they provide no sufficient guarantee that they are strictly correct. As a result of this, we must debug them to improve the quality by ourselves with spending much time. 3. To extract source code of the parser from open source compilers. There are free open source compilers available with high quality. One of the famous compilers is GNU compiler collection[2], The other is Mono C# compiler which is an open source implementation of .NET development environment available on major operating systems (e.g. Linux, Mac OS X, Please use the following format when citing this chapter:
doi:10.1007/0-387-34226-5_38 dblp:conf/oss/Maeda06 fatcat:klbqypo3unhdrhgbybwh4kg5ra