We explore the use of program transformation techniques for manipulating
CAL actor specifications, and compositions of CAL actors. Transformations
on single actors can be used to optimize a CAL specification, or to bring
it into a canonical form expected by some code generator or some other language
processor (cf. code generation). The transformations
are expressed as XSLT scripts manipulating the XML document that represents
the CAL abstract syntax tree. (More info on CAL and XML and XSLT can be found
here.)
Transformations in code generation
As outlined in the section on code generation,
program transformations are used to bring a CAL actor specification into a
form that is easier for a particular code generator to produce code for. These
transformations express some language constructs by other, more canonical,
constructs, or they annotate the program with information such as types, variable
dependencies etc. They may also depend on each other. A map of existing program
transformations can be found here.
Models of computation
Another use of program transformations is in the definition of what it means
to compose a network of actors. The description of such an actor compositor
function as a program transformation may be considered as an approach to a
notion of 'model of computation'..
Figure 1: Alternative ways to realize actor composition.
The idea is that rather than using code generators or interpreters in order
to realize a model of computation, we consider a model of computation to be
an actor composition function, i.e. a mechanism that takes a network
of actors and creates a single new actor from it. The resulting actor may
of course be further composed, or it may be fed to the CAL code generation
infrastructure.
A good introduction to these ideas can be found in these
slides by Chris Chang.