Back to table

Parallel pipe

The following is a valid µOCCAM program that performs I/O. This tests your handling of pipes and parallel processes. A process reads from stdin, sends it to another process (through a channel called pipe) and this process then outputs it to stdout. It also tries its best to confuse your compiler to test your scoping.

Program file: /public/cs3/web/ipptests/par_pipe.io

CHAN pipe:
PAR
  INT a:
  INT b:
  SEQ
    b:=99
    pipe ? b
    stdout ! b
  INT a:
  SEQ
    stdin ? a
    pipe ! a

When provided with this input: /public/cs3/web/ipptests/par_pipe.in

3

it should generate the following output: /public/cs3/web/ipptests/par_pipe.out

==> 3