ack/lang/occam/test/xxtoy.ocm

33 lines
449 B
Plaintext
Raw Normal View History

1987-02-25 17:14:10 +00:00
def otherwise=true:
def NLET= ('z'-'a')+1:
proc xxtoy(chan in, out, value x, y)=
var c:
seq
c:= not EOF
while c<>EOF
seq
in ? c
if
c=x
seq
in ? c
if
c=x
out ! y
otherwise
out ! x; c
otherwise
out ! c
:
chan link[NLET-1]:
par
xxtoy(input, link[0], 'a', 'b')
par i=[0 for NLET-2]
xxtoy(link[i], link[i+1], i+'b', i+'c')
xxtoy(link[NLET-2], output, 'y', 'z')