1.5  Alternative Syntax for Control Structures

Each of the three control structures (match/with, automaton, and present) combines equations. Each branch comprises a set of equations defining shared values. In this form, it is not necessary to explicitly define all shared variables in every branch since they implicitly keep their previous value or, for signals, become absent.

This syntactical convention mirrors the graphical representation of programs in synchronous dataflow tools (like SCADE). In such tools, control structures naturally combine (large) sets of equations and the implicit completion of absent definitions is essential.

The language also provides a derived form that allows control structures to be used in expressions. For example,

let node two x =
  match x with | true -> 1 | false -> 2

can be written as a shorthand for

let node two x =
  let match x with
     |  true -> do o = 1 done
     | false -> do o = 2 done
     end in

This notation is more conventional for OCaml programmers. A similar shorthand exists for the present and automaton constructs. One can write, for instance,

let node toggle x = y where
  rec y =
    | S0 -> do 0 until x then S1
    | S1 -> do 1 until x then S0