Home

People

Publications

Presentations

Downloads

Actors


Areas of work


Schedule

Study groups

Links


Tasks

Release 1e-100

Release date: 11 June 2002 (JWJ)
Upated: 17 June 2002 (JWJ)

Note: This code is very very unfinished. If you are not a developer, you probably do not want to see this!

This release contains the CAL parser and a few transformations that operate on the resulting DOM tree. Included is a very early prototype of the CAL->Java code generator. Do not even try to compile the result, it most likely won't work.

CAL actors are represented as XML documents (CALML). For example, the Sieve.cal actor is represented as Sieve.calml (goto the actor collection for more examples). The transformations are XLST scipts that produce annotations or change the structure of the XML document. See the page on program transformations for more details.

Requirements

The software will run under two configurations:

  • Java JDK 1.4 + Saxon:
    If you have Java JDK 1.4 installed, all you need you need is the Saxon XSLT processor, which you will find here.
  • Java JDK 1.3.x + Xalan + Crimson + Saxon:
    If you are running Java JDK 1.3.x, you will need the following packages:
    • Crimson (download here)
    • Xalan (download here)
    • Saxon (download here)

Note: If you are a Caltrop developer, you can find the Saxon jar file in developer/lib/saxon.jar in the Caltrop CVS repository. You are encouraged to use JDK 1.4.

Download

You will need to download the following:

  • The jar file containing the CAL parser and top-level programs: cal-1e-100.jar.
  • The zip file containing the transformations and the examples: data.zip.

Installation

  1. Put the caltrop.jar and the saxon.jar into your Java classpath.
    (Note: If you do not want to do this, you may simply invoke the Java interpreter with an appropriate -cp argument containing the two jar files.)

  2. Unzip the data.zip file. You should get two directories, named xslt and examples.

How to use

The Caltrop jar file contains four classes that have a main method and can thus be invoked from the command line. They read an input file, apply a number of transformations to it, and write an output file (or to stdout). They differ in what kind of input they expect (either CAL or XML) and what kind of output they produce (either XML or text that is not XML).

ReadCALWriteXML

This is invoked as follows:

java caltrop.main.ReadCALWriteXML <calfile> <output> <t1> ... <tn>

<calfile> is the name of a CAL source file, <output> the name of the desired output location, or ".", in which case the result will be written to stdout. The <ti> are transformations, i.e. .xsl that are applied in the given order to the DOM tree resulting from parsing the CAL source. E.g. the following command produces the raw DOM tree representing the AST of the Test.cal file on stdout (we assume in the following that the xslt and examples directories are in the current directory):

java caltrop.main.ReadCALWriteXML examples/Test.cal .

The next command writes the output to Test.cml:

java caltrop.main.ReadCALWriteXML examples/Test.cal Test.cml

The next command replaces while-loops in the source file, again writing to stdout:

java caltrop.main.ReadCALWriteXML examples/Test.cal . xslt/ReplaceWhileStmt.xsl

Note: Currently, some transformations (such as the ReplaceWhileStmt.xsl) load configuration data from gigascale.org at runtime. You will therefore need a working internet connection to obtain correct results.

ReadXMLWriteXML

This is invoked as follows:

java caltrop.main.ReadXMLWriteXML <xmlfile> <output> <t1> ... <tn>

The parameters have the same meaning as above, except that the first parameter, <xmlfile>, is expected to point to an XML file containing a CAL DOM tree. E.g., if you wrote to Test.cml as in the example above, you could now invoke the following command to apply the while-statement replacement transformation and write the result to stdout:

java caltrop.main.ReadXMLWriteXML Test.cml . xslt/ReplaceWhileStmt.xsl

ReadCALWriteText

This is invoked as follows:

java caltrop.main.ReadCALWriteText<xmlfile> <output> <t1> ... <tn> <txt>

This differs from ReadXMLWriteXML in that its output is an arbitrary text file, produced by its last transformation (hence there must be at least one transformation present). For example, if after applying a series of transformations, the last DOM tree is stored in Test.cml, then the following command will produce the Java actor core on stdout (or, given the current state of the code generator, fail to do so in subtle ways):

java caltrop.main.ReadCALWriteText Test.cml . xslt/GeneratorCoreActor.xsl

ReadXMLWriteText

This is invoked as follows:

java caltrop.main.ReadCALWriteText <calfile> <output> <t1> ... <tn> <txt>

This differs from ReadXMLWriteText in that its input is a CAL source file. It usually takes quite a number of transformation steps (details will be posted here) to get from full CAL to a version that can be processed by a code generator, so a useful application of this will be a rather long command line. Transformations will include, roughly in that order:

  • TagPorts
  • CanonicalizeInputPortPatterns
  • ReplaceGenerators
  • ReplaceIfExpr
  • ReplaceIfStmt
  • ReplaceWhileExpr
  • AddID
  • ReplaceOld
  • ContextInfoAnnotator
  • ReplaceOperators
  • VariableAnnotator
  • AnnotateFreeVars
  • DependencyAnnotator
  • VariableSorter
You are not logged in 
Contact 
©2002-2017 U.C. Regents