aatob.ocm 337 B

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