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.
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:
.ls
are considered to be Lucid Synchrone source
files. A file .ls
is a sequence of node declarations. From a
file f.ls
, the lucyc
compiler produces a compiled
interface f.lci
and an Objective Caml file f.ml
containing the
implementation. The .ml
file defines the corresponding
transition functions for the values defined in the input file.
.lsi
are considered to be Lucid Synchrone
interfaces, defining types and clocks for every value defined in the
implementation. From a file f.lsi
,
the compiler produces a compiled interface
f.lci
.
.dcc
are considered to be declarative
files. They are pre-compiled intermediate files obtained using
option c
.
.mli
are considered to be Objective Caml
interface files. From a file f.mli
, the
lucyc
compiler produces a compiled interface f.lci
.
Every value defined in f.mli
is considered to be a scalar value.
The following options are accepted by the lucyc
command:
.dcc
containing an
intermediate representation of the source program and a
file ending in .lci
containing a compiled interface.
node.ml
,
containing the transition function for the value
node
.
lib-dir
to the path of directories searched for compiled interface files .lci
.
level
.
The value should be a integer. The greater the value is, the greater is
the inlining (beware that the code size may increase)
info
:
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.
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:
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