Back to table

Multiple Constructions

The following is valid µOCCAM. This program simply does some calculations and some channel reads/writes, using 3 of the major constructions.

Program file: /public/cs3/web/ipptests-phase-1/multiple-cons.accept
SEQ
  INT a:
  INT b:
  INT temp:
  PAR
    INT c = (a*b) - b:
    INT d = (b*b) - a:
  PAR
    channel.c ! c
    channel.d ! d
  stdout ! c
  stdout ! d
  ALT
    channel.c ? temp
      SEQ
        temp := (temp + c) * b
        channel.c ! temp
    channel.d ? temp
      SEQ
        temp := (temp + d) * a
        channel ! temp
  STOP