loading...
SableCC, an Object-Oriented Compiler Framework
Santa Barbara, California August 03-August 07
DOI Bookmark: http://doi.ieeecomputersociety.org/10.1109/TOOLS.1998.711009Technology of Object-Oriented Languag ...
 This Article 
 
PDF
HTML
 
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
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.
Index Terms:
Compiler, Interpreter, Framework, Design Patterns, Software Engineering
Citation:
Etienne M. Gagnon, Laurie J. Hendren, "SableCC, an Object-Oriented Compiler Framework," tools, pp.140, Technology of Object-Oriented Languages and Systems, 1998
Usage of this product signifies your acceptance of the Terms of Use.