Exploiting metrics to facilitate grammar transformation into LALR format

The parser-generator yacc is one of the oldest examples of a domain-specic language, providing signicant enhancements over hand-coded parsers in the area of speed, eciency and maintainability. Despite its widespread use, often in highly complex systems such as compilers or program analysis tools, there is relatively little written about the integration of parsing, and yacc-based parsers in particular, into the software engineering process. We exploit software metrics as an aid toward estimating the complexity of preparing a grammar for the ISO C++ programming language for input to yacc. Our metrics provide a means of assessing the relative merits of the trade-o between preserving the grammar’s structure and rearranging it to ease implementation of the resulting parser. We see this work as part of a larger process of designing well-engineered, re-usable and reliable program processors, which themselves will play an important role in the future design of code-based software-engineering tools.

[1]  Brian A. Malloy,et al.  Metric-based analysis of context-free grammars , 2000, Proceedings IWPC 2000. 8th International Workshop on Program Comprehension.

[2]  Tony Mason,et al.  Lex & Yacc , 1992 .

[3]  Shari Lawrence Pfleeger,et al.  Software metrics (2nd ed.): a rigorous and practical approach , 1997 .

[4]  Stephen R. Schach Classical and Object Oriented Software Engineering , 1999 .

[5]  Donald E. Knuth,et al.  On the Translation of Languages from Left to Right , 1965, Inf. Control..

[6]  Alexandra Poulovassilis,et al.  Classical and Object-Oriented Software Engineering with UML and C++, Stephen R. Schach, McGraw-Hill, 1998 (Book Review) , 2000, Softw. Test. Verification Reliab..

[7]  Shari Lawrence Pfleeger,et al.  Software Metrics : A Rigorous and Practical Approach , 1998 .

[8]  Janos J. Sarbo Grammar Transformations for Optimizing Backtrack Parsers , 1994, Comput. Lang..

[9]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[10]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[11]  Jeffrey D. Ullman,et al.  Introduction to Automata Theory, Languages and Computation , 1979 .

[12]  B. A. Malloy,et al.  The application of correctness preserving transformations to software maintenance , 2000, Proceedings 2000 International Conference on Software Maintenance.

[13]  Bjarne Stroustrup,et al.  The Design and Evolution of C , 1994 .

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