xxtoy.ocm 449 B

1234567891011121314151617181920212223242526272829303132
  1. def otherwise=true:
  2. def NLET= ('z'-'a')+1:
  3. proc xxtoy(chan in, out, value x, y)=
  4. var c:
  5. seq
  6. c:= not EOF
  7. while c<>EOF
  8. seq
  9. in ? c
  10. if
  11. c=x
  12. seq
  13. in ? c
  14. if
  15. c=x
  16. out ! y
  17. otherwise
  18. out ! x; c
  19. otherwise
  20. out ! c
  21. :
  22. chan link[NLET-1]:
  23. par
  24. xxtoy(input, link[0], 'a', 'b')
  25. par i=[0 for NLET-2]
  26. xxtoy(link[i], link[i+1], i+'b', i+'c')
  27. xxtoy(link[NLET-2], output, 'y', 'z')