Design and implementation of a code generator for the CAL actor language

Lars Wernli

Diploma Thesis for the Swiss Federal Institute of Technology, Zurich
Technical Memorandum UCB/ERL M02/5
University of California, Berkeley, CA 94720
March 27, 2002.



This work addresses the design and implementation of a code generator which facilitates generating atomic actors for Ptolemy II from an actor specification in CAL.

CAL is a domain specific language for writing data flow actors. It is not a general purpose language, but is supposed to be embedded into a richer environment such as Ptolemy II. CAL is supposed to be independent of this embedding environment and retargetable to a rich variety of platforms. The advantage of using CAL for specifying data flow actors instead of a general purpose language like Java is that it combines the benefit of a clearer and less error-prone actor definition with an increased re-usability of the designed actors on a variety of platforms.

The code generator described in this work is separated into a generic and a Ptolemy II specific part: The generic part generates a Java class that is independent of the Ptolemy API and describes the actor behavior. The Ptolemy II specific part generates an adapter object which adapts the interface of the generic actor to the Ptolemy II API. The strict decoupling between generic and Ptolemy II specific part makes the CAL compiler easily retargetable to any other Java target platform.