The Community for Technology Leaders
Technology of Object-Oriented Languages, International Conference on (1998)
Santa Barbara, California
Aug. 3, 1998 to Aug. 7, 1998
ISBN: 0-8186-8482-8
pp: 140
Etienne M. Gagnon , McGill University
Laurie J. Hendren , McGill University
In this paper, we introduce SableCC, an object-oriented framework that generates compilers (and interpreters) in the Java programming language. This framework is based on two fundamental design decisions. Firstly, the framework uses object-oriented techniques to automatically build a strictly-typed abstract syntax tree that matches the grammar of the compiled language which simplifies debugging. Secondly, the framework generates tree-walker classes using an extended version of the visitor design pattern which enables the implementation of actions on the nodes of the abstract syntax tree using inheritance. These two design decisions lead to a tool that supports a shorter development cycle for constructing compilers.To demonstrate the simplicity of the framework, we present all the steps of building an interpreter for a mini-BASIC language. This example could be easily modified to provide an embedded scripting language in an application. We also provide a brief description of larger systems that have been implemented using the SableCC tool.We conclude that the use of object-oriented techniques significantly reduces the length of the programmer written code, can shorten the development time and finally, makes the code easier to read and maintain.
Compiler, Interpreter, Framework, Design Patterns, Software Engineering
Etienne M. Gagnon, Laurie J. Hendren, "SableCC, an Object-Oriented Compiler Framework", Technology of Object-Oriented Languages, International Conference on, vol. 00, no. , pp. 140, 1998, doi:10.1109/TOOLS.1998.711009
100 ms
(Ver 3.1 (10032016))