O2C2 – Object Oriented Compiler Construction


 O2C2 System


The aim of O2C2 is to help developers create recursive descent LL (k)-based parsers by generating a set of classes from a given syntactic specification of the language expressed in EBNF notation.







 O2C2 generated classes are organized around a framework that represents an AST (Abstract Syntax Tree). This AST’s nodes will be strictly typed so the data cannot be corrupted which helps reducing debugging time.


Each time O2C2 creates a new framework, it doesn't need to begin from zero, O2C2 relays on the O2C2-RT (O2C2 Run Time). O2C2-RT is the core of the framework, remains the same, no matter what language we are working for, and allows a level of consistency between the language processors of different languages.

The framework should be primarily a black-box framework, the user should use the classes to compose a parser and create some new classes to give a semantic meaning to the language processor.


This way of adding code to the framework is also known as the listener pattern, By using it, O2C2 allows not only the co-existence of classes provided by the user and its own classes but also the communication between both types of classes.


The tool allows the user to add action code avoiding the need to identify the different elements of the grammar. The user has to add links, that is, quoted words, in the sections of the grammar where she would like her listener classes to be called. Then, the listener classes only have to subscribe to classes whose name is that of the link.


Project Status


O2C2 is work in progress. Anyway there are some areas where the authors of O2C2 are now focusing:


·        Make O2C2 language-independent. Right now, the O2C2 run-time uses Java and the code it generates is in Java too, we plan to make O2C2 able to generate, at least, C++ code.


·        Add an editor to the Graphical User Interface that understood both rules and translations so makes O2C2 easier to use, more convenient and also more integrated.


This tool has been used in several projects, to generate a newer version of O2C2, to implement a XML non-validating parser and to build a parser for the graphical user interface of O2C2. It could be successfully used with projects both large or small.





·        Improving the Quality of Compiler Construction with Object-Oriented Techniques, David Basanta, M. Cándida Luengo, Raul Izquierdo, Jose E. Labra, J. Manuel Cueva, ACM SIGPLAN, Vol. 35, No. 12, pp. 41-51, December 2000. [Abstract]


·        Constructing Language Processors Using Object-Oriented Techniques, David Basanta, M. Cándida Luengo, Raul Izquierdo, Jose E. Labra, J. Manuel Cueva, Proceedings of the 6th International Conference on Object-Oriented Information Systems, pp. 358-367, December 2000. [Abstract]


·        O2C2: A Framework Generator for Object-Oriented Language Processors Development, M. Cándida Luengo, David Basanta, Jose E. Labra, Néstor García, Juan M. Cueva, 4 – Volume books on Software Architectures, PLAS, Components and Enterprise Framework (Submitted for publications)



Downloading O2C2


The O2C2 system has been tested in different environment.


UNIX   ( export CLASSPATH=$CLASSPATH:MY_PATH/o2c2.jar:MY_PATH/o2c2rt.jar )

Windows ( set path = %path%;MY_PATH\o2c2.jar:MY_PATH\o2c2rt.jar )



 Source Code (.zip) and Exe (.zip)

 Source Code (.tar.gz) and Exe (.tar.gz)





Last Updated: $Date: 9/2/2001 $