Previous Up

Chapter 3  The language

The language is built on top of Objective Caml [7], an ML language developed at INRIA. Many parts of this reference manual are common to Objective Caml and are borrowed from its reference manual, with the permission of the author. The present document should be used in complement with the Objective Caml reference manual.

The syntax of the language is given in BNF-like notation. Terminal symbols are set in typewriter font (like this). Non-terminal symbols are set in italic font (like that). Square brackets [ ... ] denote optional components. Curly brackets { ... } denotes zero, one or several repetitions of the enclosed components.

Chapter 4  lucyc - The batch compiler

This part describes how to transform Lucid Synchrone programs into Objective Caml programs. This is achieved by the command lucyc.

lucyc[-stdlib lib-dir] [-civ] [-realtime] [-s node]
[-I lib-dir] [-print] [-inline level] [-sampling n] filename ...

lucyc accepts four kinds of arguments:

The following options are accepted by the lucyc command:

-stdlib lib-dir
Directory for the standard library.
-c
Compile only. Produces a file ending in .dcc containing an intermediate representation of the source program and a file ending in .lci containing a compiled interface.
-i
Print types and clocks. The output can be used directly for building Lucid Synchrone interfaces.
-v
Prints the compiler version number.
-realtime
Real-time mode of the compiler. Only accept programs for which the generated transition function can be executed in bounded time and memory. In the current implementation, only non recursive nodes are allowed.
-s node
Produces a file node.ml, containing the transition function for the value node.
-I lib-dir
Adds lib-dir to the path of directories searched for compiled interface files .lci.
-inline level
Sets the level of inlining to level. The value should be a integer. The greater the value is, the greater is the inlining (beware that the code size may increase)
-print info
Print information according to info:
type
print type
clock
print clock type
caus
print causality type
init
print initialization type
all
print all types
-sampling n
Set the sampling frequency to 1/n. When [n=0], the program is executed at full speed.

Warning: It is essential that the sampling rate given here be the same as the one used in the synchronous program. Moreover, the user must check that the execution time of the reaction is always less than the sampling rate.

Chapter 5  The simulator

Appart from the compiler, a simple simulator is proposed for observing a program. It is connected to the chronogram Sim2chro if it is available.

  lucys -s node [-v] [-tk] filename.lci

lucys is a simulator for the Lucid Synchrone programming language (see lucyc). lucys generates an Objective Caml program for simulating a node node defined in the compiled interface filename.lci. This program produces a graphical interface allowing the user to give some inputs to the node and to compute the current reaction.

In order to simulate a node node from a source file filename.ls, you must type:

lucyc -s node filename.ls
lucys -s node filename.lci

Once the simulator have been generated, it should in turn be compiled with the Objective Caml compiler by typing the following command:

  ocamlc -o node unix.cma -I +lablgtk2 lablgtk.cma <obj_files> <node>_sim.ml

The graphic window of the simulator is organised as follows: the inputs are given on the top left; the outputs on the top right and control buttons are given on the bottom. Each input and each output is represented by one button. The presentation of the buttons follows the tree structure of the node’s type.

Two modes are provided for simulating the node. In the "step" mode, the user sets several inputs and the reaction is computed when pressing the button "step". When the "step" button is switched on "autostep", an output is computed as soon as a boolean input becomes true. The "reset" button is used to reset the node, which gets back to its initial state.

When the tool sim2chro has been installed, input/output of the node are given to him for printing a chronogram. Otherwise, the simulator only provide a limited chronogram facility.

The following options are accepted by the lucyc command:

-s node
Produces an event driven simulator node_sim.ml for node. The node should be defined in the compiled interface filename. Moreover, some type and clock restrictions apply to the node (see Restrions below).

Once the simulator have been generated, it should in turn be compiled with the Objective Caml compiler by typing the following command:

  ocamlc -o node -I +lablgtk2 lablgtk.cma <obj_files> <node>_sim.ml

References

[1]
E. A. Ashcroft and W. W. Wadge. Lucid, a non procedural language with iteration. Communications of the ACM, 20(7):519–526, 1977.
[2]
Gérard Berry. The esterel v5 language primer, version 5.21 release 2.0. Draft book, 1999.
[3]
Jean-Louis Colaço and Marc Pouzet. Type-based initialization analysis of a synchronous data-flow language. International Journal on Software Tools for Technology Transfer (STTT), 6(3):245–255, August 2004.
[4]
N. Halbwachs, P. Caspi, P. Raymond, and D. Pilaud. The synchronous dataflow programming language Lustre. Proceedings of the IEEE, 79(9):1305–1320, September 1991.
[5]
Kevin Hammond. Hume. http://www-fp.dcs.st-and.ac.uk/hume/.
[6]
Gilles Kahn. The semantics of simple language for parallel programming. In IFIP 74 Congress, 1974.
[7]
Xavier Leroy. The Objective Caml system release 3.09. Documentation and user’s manual. Technical report, INRIA, 2005.
[8]
F. Maraninchi and Y. Rémond. Mode-automata: a new domain-specific construct for the development of safe critical systems. Science of Computer Programming, 46:219–254, 2003.
[9]
Robin Milner. Communication and Concurrency. Prentice Hall, 1989.

Previous Up