A Java code generator for Esterel programs



Table of contents


Introduction

Ocjava is the Esterel Java code generator. It generates Java code for Esterel programs. It is normally called via the Esterel compiler. It can also be called directly by the user if necessary.



Description of the ocjava processor

Ocjava code producer generates Java code for Esterel programs either from the automaton format representation of programs (oc format) or from the sorted sequential code representation (ssc format).

Error messages and warnings are written to the standard error stream. Error messages should be self-explanatory. Typical use is:

    esterel -Ajava game.strl or ocjava  game.oc 
    esterel -Ljava game.strl or sscjava game.ssc 

For each module in the source file, a module.java file is generated and may be compiled with java compiler and interpreted with java interpret. Nevertheless, both java compilation and interpretation require a general OcMachine.java file supplied in a library joined to the distribution. The ocjava lib must be included in user classpath.

Moreover, User defined classes referred to by methods and classes included in the generated java code should be supplied by users. First of all, a class moduleAppli should be provided and must contain the definition of the main method. In addition, Interface classes where input and output methods are set as well as Java classes to implement external types declared in the Esterel module are also requiered.

For instance, the previous commands both generate a game.java file, and usual use of this generated file is:

      javac game.java gameAppli.java 
      java gameAppli 

Options

The following options are interpreted by Ocjava:

-version Print the version name on the standard error output stream and terminate ignoring all other arguments.
-info Print various informations about the processor compilation on the standard error output stream and terminate, ignoring all other arguments.
-access Print access rights to the processor on the standard error output stream and terminate, ignoring all other arguments.
-s Silent mode: perform parsing and type-checking but do not generate the sc code.
-p <package> Generate an import declaration : import package.*; in the main java file related to each esterel module included in the command line.
-ssc Generate Java output code from ssc format.


Getting Ocjava

The Ocjava processor is available for the following architectures:

Distributions contain ocjava and sscjava executable files, the manual page ocjave.1, the lib directory and some demos to illustrate processor running. Just copy the executables in the <Esterel dir>/bin directory and the manual page in the <Esterel dir>/man/man1 directory. Then one can directly apply the following command:

    esterel -Ljava game.strl or esterel -Ajava game.strl 

to obtain directly the file game.java.

Send bug reports to Annie Ressouche.



Related publications