Files @ 36cc1fe490f7
Branch filter:

Location: CSY/reowolf/testdata/parser/positive/18.pdl

MH
Merge branch 'feat-api-cmds-and-branching'

Implements the programmer-facing API to allow programmatic
specification of a synchronous round. The way in which these put/get
interactions are performed is in an initial shape. Perhaps this will
change in the future.

The second main set of changes is the addion of a 'fork' statement,
which allows explicit forking, and allowing multiple puts/gets over the
same transport link within a single sync round.
#version 100

import std.reo;

composite main() {}

primitive main1(in a, out c) {
	int x = 0;
	int y = 0;
	msg z = null;
	msg w = null;
	x = 1;
	y = 1;
	while (true) {
		sync {
			if (x > 0 && fires(a)) {
				z = get(a);
				x--;
			}
			if (w != null && fires(c)) {
				put(c, w);
				w = null;
				y++;
			}
		}
		sync {
			assert !fires(a) && !fires(c);
			if (z != null && y > 0) {
				w = z;
				z = null;
				y--;
				x++;
			}
		}
	}
}

composite main2(in a, out c) {
	channel xo -> xi;
	new fifo(a, xo, null);
	new fifo(xi, c, null);
}