Changeset - 2982ea49738a
[Not reviewed]
MH - 4 years ago 2021-11-12 14:05:56
contact@maxhenger.nl
rename 'synchronous' statement to 'sync'
45 files changed with 113 insertions and 113 deletions:
0 comments (0 inline, 0 general)
examples/bench_04/main.c
Show inline comments
 
@@ -8,7 +8,7 @@ int main(int argc, char** argv) {
 

	
 
	const unsigned char pdl[] = 
 
	"primitive trivial_loop() {   "
 
	"    while(true) synchronous{}"
 
	"    while(true) sync {}"
 
	"}                            "
 
	;
 
	Arc_ProtocolDescription * pd = protocol_description_parse(pdl, sizeof(pdl)-1);
examples/bench_05/main.c
Show inline comments
 
@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
 

	
 
	const unsigned char pdl[] = 
 
	"primitive trivial_loop() {   "
 
	"    while(true) synchronous{}"
 
	"    while(true) sync {}"
 
	"}                            "
 
	;
 
	Arc_ProtocolDescription * pd = protocol_description_parse(pdl, sizeof(pdl)-1);
examples/bench_09/main.c
Show inline comments
 
@@ -12,7 +12,7 @@ int main(int argc, char** argv) {
 
	"    while(true) {            "
 
	"        i = 0;               "
 
	"        while(i < 2)  i++;   "
 
	"        synchronous {}       "
 
	"        sync {}       "
 
	"    }                        "
 
	"}                            "
 
	;
examples/bench_11/main.c
Show inline comments
 
@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
 
		forwards, num_options);
 
	unsigned char pdl[] = 
 
	"primitive recv_zero(in a) {  "
 
	"    while(true) synchronous {"
 
	"    while(true) sync {"
 
	"        msg m = get(a);      "
 
	"        assert(m[0] == 0);   "
 
	"    }                        "
examples/bench_23/main.c
Show inline comments
 
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
 

	
 
	// unsigned char pdl[] = "\
 
	// primitive xrouter(in a, out b, out c) {\
 
 //        while(true) synchronous {\
 
 //        while(true) sync {\
 
 //            if(fires(a)) {\
 
 //                if(fires(b)) put(b, get(a));\
 
 //                else         put(c, get(a));\
 
@@ -16,7 +16,7 @@ int main(int argc, char** argv) {
 
 //    ;
 
	unsigned char pdl[] = "\
 
	primitive lossy(in a, out b) {\
 
        while(true) synchronous {\
 
        while(true) sync {\
 
            if(fires(a)) {\
 
                msg m = get(a);\
 
                if(fires(b)) put(b, m);\
 
@@ -24,7 +24,7 @@ int main(int argc, char** argv) {
 
        }\
 
    }\
 
    primitive sync_drain(in a, in b) {\
 
        while(true) synchronous {\
 
        while(true) sync {\
 
            if(fires(a)) {\
 
                get(a);\
 
                get(b);\
examples/bench_24/main.c
Show inline comments
 
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
 

	
 
	unsigned char pdl[] = "\
 
	primitive fifo1_init(msg m, in a, out b) {\
 
        while(true) synchronous {\
 
        while(true) sync {\
 
            if(m != null && fires(b)) {\
 
                put(b, m);\
 
                m = null;\
 
@@ -39,7 +39,7 @@ int main(int argc, char** argv) {
 
	// unsigned char pdl[] = "\
 
	// primitive sequencer3(out a, out b, out c) {\
 
 //        int i = 0;\
 
 //        while(true) synchronous {\
 
 //        while(true) sync {\
 
 //            out to = a;\
 
 //            if     (i==1) to = b;\
 
 //            else if(i==2) to = c;\
examples/bench_27/main.c
Show inline comments
 
@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
 

	
 
    unsigned char pdl[] = "\
 
    primitive xrouter(in a, out b, out c) {\
 
        while(true) synchronous {\
 
        while(true) sync {\
 
            if(fires(a)) {\
 
                if(fires(b)) put(b, get(a));\
 
                else         put(c, get(a));\
examples/eg_protocols.pdl
Show inline comments
 
primitive pres_2(in i, out o) {
 
  synchronous {
 
  sync {
 
    put(o, get(i));
 
  }
 
}
 
primitive together(in ia, in ib, out oa, out ob){
 
  while(true) synchronous {
 
  while(true) sync {
 
    if(fires(ia)) {
 
      put(oa, get(ia));
 
      put(ob, get(ib));
 
@@ -14,7 +14,7 @@ primitive together(in ia, in ib, out oa, out ob){
 

	
 
primitive alt_round_merger(in a, in b, out c){
 
  while(true) {
 
    synchronous{ put(c, get(a)); }
 
    synchronous{ put(c, get(b)); }
 
    sync { put(c, get(a)); }
 
    sync { put(c, get(b)); }
 
  }	
 
}
src/protocol/parser/token_parsing.rs
Show inline comments
 
@@ -45,7 +45,7 @@ pub(crate) const KW_STMT_BREAK:    &'static [u8] = b"break";
 
pub(crate) const KW_STMT_CONTINUE: &'static [u8] = b"continue";
 
pub(crate) const KW_STMT_GOTO:     &'static [u8] = b"goto";
 
pub(crate) const KW_STMT_RETURN:   &'static [u8] = b"return";
 
pub(crate) const KW_STMT_SYNC:     &'static [u8] = b"synchronous";
 
pub(crate) const KW_STMT_SYNC:     &'static [u8] = b"sync";
 
pub(crate) const KW_STMT_NEW:      &'static [u8] = b"new";
 

	
 
// Keywords - types
src/runtime/tests.rs
Show inline comments
 
@@ -37,9 +37,9 @@ fn file_logged_configured_connector(
 
    Connector::new(file_logger, pd, connector_id)
 
}
 
static MINIMAL_PDL: &'static [u8] = b"
 
primitive sync(in<msg> a, out<msg> b) {
 
primitive sync_component(in<msg> a, out<msg> b) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b)) {
 
            	msg x = get(a);
 
            	put(b, x);
 
@@ -51,7 +51,7 @@ primitive sync(in<msg> a, out<msg> b) {
 
}
 

	
 
primitive together(in<msg> ia, in<msg> ib, out<msg> oa, out<msg> ob){
 
  while(true) synchronous {
 
  while(true) sync {
 
    if(fires(ia)) {
 
      put(oa, get(ia));
 
      put(ob, get(ib));
 
@@ -102,7 +102,7 @@ fn new_sync() {
 
    let test_log_path = Path::new("./logs/new_sync");
 
    let mut c = file_logged_connector(0, test_log_path);
 
    let [o, i] = c.new_port_pair();
 
    c.add_component(b"", b"sync", &[i, o]).unwrap();
 
    c.add_component(b"", b"sync_component", &[i, o]).unwrap();
 
}
 

	
 
#[test]
 
@@ -353,7 +353,7 @@ fn cannot_use_moved_ports() {
 
    let test_log_path = Path::new("./logs/cannot_use_moved_ports");
 
    let mut c = file_logged_connector(0, test_log_path);
 
    let [p, g] = c.new_port_pair();
 
    c.add_component(b"", b"sync", &[g, p]).unwrap();
 
    c.add_component(b"", b"sync_component", &[g, p]).unwrap();
 
    c.connect(SEC1).unwrap();
 
    c.put(p, TEST_MSG.clone()).unwrap_err();
 
    c.get(g).unwrap_err();
 
@@ -369,7 +369,7 @@ fn sync_sync() {
 
    let mut c = file_logged_connector(0, test_log_path);
 
    let [p0, g0] = c.new_port_pair();
 
    let [p1, g1] = c.new_port_pair();
 
    c.add_component(b"", b"sync", &[g0, p1]).unwrap();
 
    c.add_component(b"", b"sync_component", &[g0, p1]).unwrap();
 
    c.connect(SEC1).unwrap();
 
    c.put(p0, TEST_MSG.clone()).unwrap();
 
    c.get(g1).unwrap();
 
@@ -421,7 +421,7 @@ fn distributed_msg_bounce() {
 
                c.new_net_port(Putter, sock_addrs[0], Active).unwrap(),
 
                c.new_net_port(Getter, sock_addrs[1], Active).unwrap(),
 
            ];
 
            c.add_component(b"", b"sync", &[g, p]).unwrap();
 
            c.add_component(b"", b"sync_component", &[g, p]).unwrap();
 
            c.connect(SEC1).unwrap();
 
            c.sync(SEC1).unwrap();
 
        });
 
@@ -882,7 +882,7 @@ fn ac_not_b() {
 
            let pdl = b"
 
            primitive ac_not_b(in<msg> a, in<msg> b, out<msg> c){
 
                // forward A to C but keep B silent
 
                synchronous{ put(c, get(a)); }
 
                sync { put(c, get(a)); }
 
            }";
 
            let pd = Arc::new(reowolf::ProtocolDescription::parse(pdl).unwrap());
 
            let mut c = file_logged_configured_connector(1, test_log_path, pd);
 
@@ -946,7 +946,7 @@ fn many_rounds_mem() {
 
fn pdl_reo_lossy() {
 
    let pdl = b"
 
    primitive lossy(in<msg> a, out<msg> b) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            msg m = null;
 
            if(fires(a)) {
 
                m = get(a);
 
@@ -965,7 +965,7 @@ fn pdl_reo_fifo1() {
 
    let pdl = b"
 
    primitive fifo1(in<msg> a, out<msg> b) {
 
        msg m = null;
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(m == null) {
 
                if(fires(a)) m=get(a);
 
            } else {
 
@@ -985,7 +985,7 @@ fn pdl_reo_fifo1full() {
 
    primitive fifo1full(in<msg> a, out<msg> b) {
 
        bool is_set = true;
 
        msg m = create(0);
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(!is_set) {
 
                if(fires(a)) m=get(a);
 
                is_set = false;
 
@@ -1012,7 +1012,7 @@ fn pdl_msg_consensus() {
 
    let test_log_path = Path::new("./logs/pdl_msg_consensus");
 
    let pdl = b"
 
    primitive msgconsensus(in<msg> a, in<msg> b) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            msg x = get(a);
 
            msg y = get(b);
 
            assert(x == y);
 
@@ -1040,7 +1040,7 @@ fn sequencer3_prim() {
 
    let pdl = b"
 
    primitive sequencer3(out<msg> a, out<msg> b, out<msg> c) {
 
        u32 i = 0;
 
        while(true) synchronous {
 
        while(true) sync {
 
            out to = a;
 
            if     (i==1) to = b;
 
            else if(i==2) to = c;
 
@@ -1087,7 +1087,7 @@ fn sequencer3_comp() {
 
    let pdl = b"
 
    primitive replicator<T>(in<T> a, out<T> b, out<T> c) {
 
        while (true) {
 
            synchronous {
 
            sync {
 
                if (fires(a) && fires(b) && fires(c)) {
 
                    msg x = get(a);
 
                    put(b, x);
 
@@ -1099,7 +1099,7 @@ fn sequencer3_comp() {
 
        }
 
    }
 
    primitive fifo1_init<T>(bool has_value, T m, in<T> a, out<T> b) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(has_value && fires(b)) {
 
                put(b, m);
 
                has_value = false;
 
@@ -1181,7 +1181,7 @@ fn xrouter_prim() {
 
    let test_log_path = Path::new("./logs/xrouter_prim");
 
    let pdl = b"
 
    primitive xrouter(in<msg> a, out<msg> b, out<msg> c) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(fires(a)) {
 
                if(fires(b)) put(b, get(a));
 
                else         put(c, get(a));
 
@@ -1222,7 +1222,7 @@ fn xrouter_comp() {
 
    let pdl = b"
 
    primitive replicator<T>(in<T> a, out<T> b, out<T> c) {
 
        while (true) {
 
            synchronous {
 
            sync {
 
                if (fires(a) && fires(b) && fires(c)) {
 
                    msg x = get(a);
 
                    put(b, x);
 
@@ -1236,7 +1236,7 @@ fn xrouter_comp() {
 

	
 
    primitive merger(in<msg> a, in<msg> b, out<msg> c) {
 
        while (true) {
 
            synchronous {
 
            sync {
 
                if (fires(a) && !fires(b) && fires(c)) {
 
                    put(c, get(a));
 
                } else if (!fires(a) && fires(b) && fires(c)) {
 
@@ -1249,7 +1249,7 @@ fn xrouter_comp() {
 
    }
 

	
 
    primitive lossy<T>(in<T> a, out<T> b) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(fires(a)) {
 
                auto m = get(a);
 
                if(fires(b)) put(b, m);
 
@@ -1257,7 +1257,7 @@ fn xrouter_comp() {
 
        }
 
    }
 
    primitive sync_drain<T>(in<T> a, in<T> b) {
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(fires(a)) {
 
                msg drop_it = get(a);
 
                msg on_the_floor = get(b);
 
@@ -1320,7 +1320,7 @@ fn count_stream() {
 
    primitive count_stream(out<msg> o) {
 
        msg m = create(1);
 
        m[0] = 0;
 
        while(true) synchronous {
 
        while(true) sync {
 
            put(o, m);
 
            m[0] += 1;
 
        }
 
@@ -1351,7 +1351,7 @@ fn for_msg_byte() {
 
        while(i<8) {
 
            msg m = create(1);
 
            m[idx] = i;
 
            synchronous put(o, m);
 
            sync put(o, m);
 
            i += 1;
 
        }
 
    }
 
@@ -1379,7 +1379,7 @@ fn eq_causality() {
 
    primitive eq(in<msg> a, in<msg> b, out<msg> c) {
 
        msg ma = create(0);
 
        msg mb = create(0);
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(fires(a)) {
 
                // b and c also fire!
 
                // left first!
 
@@ -1435,7 +1435,7 @@ fn eq_no_causality() {
 
    primitive eqinner(in<msg> a, in<msg> b, out<msg> c, out<msg> leftfirsto, in<msg> leftfirsti) {
 
        msg ma = create(0);
 
        msg mb = create(0);
 
        while(true) synchronous {
 
        while(true) sync {
 
            if(fires(a)) {
 
                // b and c also fire!
 
                if(fires(leftfirsti)) {
src/runtime2/tests/api_component.rs
Show inline comments
 
@@ -11,7 +11,7 @@ fn test_put_and_get() {
 
    primitive handler(in<u32> request, out<u32> response, u32 loops) {
 
        u32 index = 0;
 
        while (index < loops) {
 
            synchronous {
 
            sync {
 
                auto value = get(request);
 
                put(response, value * 2);
 
            }
 
@@ -54,7 +54,7 @@ fn test_getting_from_component() {
 
    const CODE: &'static str ="
 
    primitive loop_sender(out<u32> numbers, u32 cur, u32 last) {
 
        while (cur < last) {
 
            synchronous {
 
            sync {
 
                put(numbers, cur);
 
                cur += 1;
 
            }
 
@@ -93,7 +93,7 @@ fn test_putting_to_component() {
 
    const CODE: &'static str = "
 
    primitive loop_receiver(in<u32> numbers, u32 cur, u32 last) {
 
        while (cur < last) {
 
            synchronous {
 
            sync {
 
                auto number = get(numbers);
 
                assert(number == cur);
 
                cur += 1;
src/runtime2/tests/network_shapes.rs
Show inline comments
 
@@ -8,7 +8,7 @@ fn test_put_and_get() {
 
    primitive putter(out<bool> sender, u32 loops) {
 
        u32 index = 0;
 
        while (index < loops) {
 
            synchronous {
 
            sync {
 
                put(sender, true);
 
            }
 
            index += 1;
 
@@ -18,7 +18,7 @@ fn test_put_and_get() {
 
    primitive getter(in<bool> receiver, u32 loops) {
 
        u32 index = 0;
 
        while (index < loops) {
 
            synchronous {
 
            sync {
 
                auto result = get(receiver);
 
                assert(result);
 
            }
 
@@ -49,7 +49,7 @@ fn test_star_shaped_request() {
 
    primitive edge(in<u32> input, out<u32> output, u32 loops) {
 
        u32 index = 0;
 
        while (index < loops) {
 
            synchronous {
 
            sync {
 
                auto req = get(input);
 
                put(output, req * 2);
 
            }
 
@@ -63,7 +63,7 @@ fn test_star_shaped_request() {
 

	
 
        while (loop_index < loops) {
 
            // print(\"starting loop\");
 
            synchronous {
 
            sync {
 
                u32 edge_index = 0;
 
                u32 sum = 0;
 
                while (edge_index < num_edges) {
 
@@ -115,7 +115,7 @@ fn test_conga_line_request() {
 
        u32 loop_index = 0;
 
        u32 initial_value = 1337;
 
        while (loop_index < num_loops) {
 
            synchronous {
 
            sync {
 
                put(req, initial_value);
 
                auto result = get(resp);
 
                assert(result == initial_value + num_nodes * 2);
 
@@ -131,7 +131,7 @@ fn test_conga_line_request() {
 
    ) {
 
        u32 loop_index = 0;
 
        while (loop_index < num_loops) {
 
            synchronous {
 
            sync {
 
                auto req = get(req_in);
 
                put(req_forward, req + 1);
 
                auto resp = get(resp_in);
 
@@ -144,7 +144,7 @@ fn test_conga_line_request() {
 
    primitive end(in<u32> req_in, out<u32> resp_out, u32 num_loops) {
 
        u32 loop_index = 0;
 
        while (loop_index < num_loops) {
 
            synchronous {
 
            sync {
 
                auto req = get(req_in);
 
                put(resp_out, req);
 
            }
testdata/parser/negative/1.pdl
Show inline comments
 
@@ -3,8 +3,8 @@
 
// sync block nested twice in primitive
 
primitive main(in a, out b) {
 
	while (true) {
 
		synchronous {
 
			synchronous {}
 
		sync {
 
			sync {}
 
		}
 
	}
 
}
testdata/parser/negative/1.txt
Show inline comments
 
Parse error at 1.pdl:7:4: Illegal nested synchronous statement
 
			synchronous {}
 
			sync {}
 
			^
testdata/parser/negative/10.pdl
Show inline comments
 
@@ -3,9 +3,9 @@
 
// sync block nested in sync block
 
primitive main(in a, out b) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (false || true) {
 
				synchronous {
 
				sync {
 
					skip;
 
				}
 
			}
testdata/parser/negative/10.txt
Show inline comments
 
Parse error at 10.pdl:8:5: Illegal nested synchronous statement
 
				synchronous {
 
				sync {
 
				^
testdata/parser/negative/12.pdl
Show inline comments
 
@@ -4,6 +4,6 @@
 
primitive main(in a, out b) {
 
	while (true) {
 
		channel x -> y;
 
		synchronous {}
 
		sync {}
 
	}
 
}
testdata/parser/negative/19.pdl
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
primitive main(in a) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (fires(a)) {
 
				return 5;
 
			} else {
testdata/parser/negative/24.pdl
Show inline comments
 
@@ -7,7 +7,7 @@ primitive main(in a, out b) {
 
	y %= x -= 3;
 
	x *= x * x *= 5;
 
	while (true) {
 
		synchronous {
 
		sync {
 
			assert fires(a) == fires(b);
 
		}
 
	}
testdata/parser/negative/3.pdl
Show inline comments
 
@@ -4,7 +4,7 @@
 
composite main(in a, out b) {
 
	channel x -> y;
 
	while (true) {
 
		synchronous {
 
		sync {
 
			skip;
 
		}
 
	}
testdata/parser/negative/3.txt
Show inline comments
 
Parse error at 3.pdl:7:3: Illegal nested synchronous statement
 
		synchronous {
 
		sync {
 
		^
testdata/parser/negative/31.pdl
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
primitive main(int a) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            break; // not allowed
 
        }
 
    }
testdata/parser/negative/32.pdl
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
primitive main(int a) {
 
    loop: {
 
        synchronous {
 
        sync {
 
            goto loop; // not allowed
 
        }
 
    }
testdata/parser/negative/4.pdl
Show inline comments
 
@@ -6,7 +6,7 @@ primitive main(in a, out b) {
 
	msg y = create(0); // legal
 
	while (x < 10) {
 
		y = get(a); // illegal
 
		synchronous {
 
		sync {
 
			y = get(a); // legal
 
		}
 
	}
testdata/parser/negative/6.pdl
Show inline comments
 
@@ -4,5 +4,5 @@ import std.reo;
 

	
 
// duplicate formal parameters
 
composite main(in a, out a) {
 
	new sync(a, a);
 
	new sync_component(a, a);
 
}
testdata/parser/negative/7.pdl
Show inline comments
 
@@ -5,5 +5,5 @@ import std.reo;
 
// shadowing formal parameter
 
composite main(in a, out b) {
 
	channel c -> a;
 
	new sync(a, b);
 
	new sync_component(a, b);
 
}
testdata/parser/negative/8.pdl
Show inline comments
 
@@ -10,7 +10,7 @@ composite main(in a, out b) {
 
// shadowing import
 
primitive syncdrain(in a, in b) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (!fires(a) || !fires(b)) {
 
				block(a);
 
				block(b);
testdata/parser/positive/1.pdl
Show inline comments
 
@@ -11,7 +11,7 @@ composite main(in asend, out arecv, in bsend, out brecv) {
 

	
 
primitive replicator(in a, out b, out c) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b) && fires(c)) {
 
                msg x = get(a);
 
                put(b, x);
 
@@ -40,7 +40,7 @@ composite sequencer(in x, in y) {
 

	
 
primitive syncdrain(in a, in b) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b)) {
 
                get(a);
 
                get(b);
 
@@ -54,7 +54,7 @@ primitive syncdrain(in a, in b) {
 
primitive fifo(in a, out b, msg init) {
 
    msg c = init;
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (c != null) {
 
                assert !fires(a);
 
                if (fires(b)) {
 
@@ -75,7 +75,7 @@ primitive sequencer2(in x, in y) {
 
	while (true) {
 
	    boolean b = false;
 
		while (!b) {
 
			synchronous {
 
			sync {
 
				assert !fires(y);
 
				if (fires(x))
 
					b = true;
 
@@ -83,7 +83,7 @@ primitive sequencer2(in x, in y) {
 
		}
 
		b = false;
 
		while (!b) {
 
			synchronous {
 
			sync {
 
				assert !fires(x);
 
				if (fires(y))
 
					b = true;
testdata/parser/positive/10.pdl
Show inline comments
 
@@ -4,7 +4,7 @@ composite main() {}
 

	
 
primitive example(in a, out[] b) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (fires(a)) {
 
				int i = 0;
 
				while (i < b.length) {
testdata/parser/positive/11.pdl
Show inline comments
 
@@ -3,13 +3,13 @@
 
primitive main(in a, out b) {
 
	msg x = null;
 
	while (x == null) {
 
		synchronous {
 
		sync {
 
			if (fires(a))
 
				x = get(a);
 
		}
 
	}
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (fires(b))
 
				put(b, x);
 
		}
testdata/parser/positive/12.pdl
Show inline comments
 
@@ -7,7 +7,7 @@ primitive main(in a, out b) {
 
	y %= x -= 3;
 
	x *= x * (x *= 5);
 
	while (true) {
 
		synchronous {
 
		sync {
 
			assert fires(a) == fires(b);
 
		}
 
	}
testdata/parser/positive/13.pdl
Show inline comments
 
@@ -14,7 +14,7 @@ composite example(in[] a, in[] b, out x) {
 

	
 
primitive resolve(in[] a, in[] b, out x) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			int i = 0;
 
			while (i < a.length && i < b.length) {
 
				if (fires(a[i]) && fires(b[i])) {
 
@@ -31,7 +31,7 @@ primitive resolve(in[] a, in[] b, out x) {
 

	
 
primitive async(in[] a) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			int i = 0;
 
			while (i < a.length)
 
				if (fires(a[i++])) break;
testdata/parser/positive/14.pdl
Show inline comments
 
@@ -3,13 +3,13 @@
 
composite main(out c) {
 
	channel ao -> ai;
 
    channel bo -> bi;
 
	new sync(ai, bo);
 
	new sync_component(ai, bo);
 
	new binary_replicator(bi, ao, c);
 
}
 

	
 
primitive sync(in a, out b) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b)) {
 
            	msg x = get(a);
 
            	put(b, x);
 
@@ -22,7 +22,7 @@ primitive sync(in a, out b) {
 

	
 
primitive binary_replicator(in b, out a, out c) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(b) && fires(a) && fires(c)) {
 
                msg x = get(b);
 
                put(a, x);
testdata/parser/positive/15.pdl
Show inline comments
 
@@ -7,7 +7,7 @@ composite main(out c) {
 
	channel bo -> bi;
 
	channel axo -> axi;
 
	channel zo -> zi;
 
	new sync(ai, bo);
 
	new sync_component(ai, bo);
 
	new replicator(bi, {axo, c});
 
	new consensus({axi, zi}, ao);
 
	new generator(zo);
testdata/parser/positive/16.pdl
Show inline comments
 
@@ -7,7 +7,7 @@ composite main() {
 
}
 

	
 
primitive a(in x) {
 
	synchronous {
 
	sync {
 
		msg m = get(x);
 
		assert m.length == 5;
 
		assert m[0] == 'h';
 
@@ -25,7 +25,7 @@ primitive b(out x) {
 
}
 
// or
 
primitive c(out x) {
 
	synchronous {
 
	sync {
 
		msg m = create(5);
 
		m[0] = 'h';
 
		m[1] = 'e';
testdata/parser/positive/17.pdl
Show inline comments
 
@@ -8,7 +8,7 @@ primitive prophet(in b, out a) {
 
	msg c = null;
 
	while (true) {
 
		if (c != null) {
 
			synchronous {
 
			sync {
 
				assert !fires(a);
 
				if (fires(b)) {
 
					assert get(b) == c;
 
@@ -31,7 +31,7 @@ primitive fifo(in a, out b, msg init) {
 
    msg c = init;
 
    while (true) {
 
        if (c != null) {
 
        	synchronous {
 
        	sync {
 
                assert !fires(a);
 
                if (fires(b)) {
 
                    put(b, c);
 
@@ -39,7 +39,7 @@ primitive fifo(in a, out b, msg init) {
 
                }
 
            }
 
        } else {
 
        	synchronous {
 
        	sync {
 
                assert !fires(b);
 
                if (fires(a)) {
 
                    c = get(a);
testdata/parser/positive/18.pdl
Show inline comments
 
@@ -12,7 +12,7 @@ primitive main1(in a, out c) {
 
	x = 1;
 
	y = 1;
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (x > 0 && fires(a)) {
 
				z = get(a);
 
				x--;
 
@@ -23,7 +23,7 @@ primitive main1(in a, out c) {
 
				y++;
 
			}
 
		}
 
		synchronous {
 
		sync {
 
			assert !fires(a) && !fires(c);
 
			if (z != null && y > 0) {
 
				w = z;
testdata/parser/positive/19.pdl
Show inline comments
 
@@ -3,7 +3,7 @@
 
composite main() {}
 

	
 
primitive example(int a) {
 
    synchronous {
 
    sync {
 
        loop: {
 
            goto loop; // allowed
 
        }
testdata/parser/positive/2.pdl
Show inline comments
 
@@ -16,7 +16,7 @@ composite main(in asend, out arecv, in bsend, out brecv, in csend, out crecv) {
 

	
 
primitive mymerger(in a, in b, out c) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && !fires(b) && fires(c)) {
 
                put(c, get(a));
 
            } else if (!fires(a) && fires(b) && fires(c)) {
testdata/parser/positive/3.pdl
Show inline comments
 
@@ -30,7 +30,7 @@ composite main(in ai, out ao, in bi, out bo, in ci, out co, in di, out do) {
 

	
 
primitive computeMax(in a, in b, in c, in d, out x) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
            if (fires(a) && fires(b) && fires(c) && fires(d) && fires(x)) {
 
            	msg aa = get(a);
 
            	msg bb = get(b);
testdata/parser/positive/5.pdl
Show inline comments
 
@@ -5,7 +5,7 @@ import std.buf;
 

	
 
primitive main(in a, out b) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b)) {
 
                msg x = get(a);
 
                short y = readShort(x, 0);
testdata/parser/positive/6.pdl
Show inline comments
 
@@ -14,7 +14,7 @@ composite replicator(in a, out[] b) {
 
	if (b.length == 0) {
 
		new blocking(a);
 
	} else if (b.length == 1) {
 
		new sync(a, b[0]);
 
		new sync_component(a, b[0]);
 
	} else {
 
		channel xo -> xi;
 
		new binary_replicator(a, b[0], xo);
 
@@ -23,7 +23,7 @@ composite replicator(in a, out[] b) {
 
}
 
primitive binary_replicator(in a, out b, out c) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b) && fires(c)) {
 
                msg x = get(a);
 
                put(b, x);
 
@@ -35,7 +35,7 @@ primitive binary_replicator(in a, out b, out c) {
 
    }
 
}
 
primitive blocking(in a) {
 
	while (true) synchronous {
 
	while (true) sync {
 
		assert !fires(a);
 
	}
 
}
 
@@ -52,12 +52,12 @@ composite merger(in[] a, out b) {
 
			prev = yi;
 
			i++;
 
		}
 
		new sync(prev, b);
 
		new sync_component(prev, b);
 
	}
 
}
 
primitive binary_merger(in a, in b, out c) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(c)) {
 
                assert !fires(b);
 
                put(c, get(a));
 
@@ -71,14 +71,14 @@ primitive binary_merger(in a, in b, out c) {
 
    }
 
}
 
primitive silent(out a) {
 
	while (true) synchronous {
 
	while (true) sync {
 
		assert !fires(a);
 
	}
 
}
 

	
 
primitive sync(in a, out b) {
 
    while (true) {
 
        synchronous {
 
        sync {
 
            if (fires(a) && fires(b)) {
 
            	put(b, get(a));
 
            } else {
testdata/parser/positive/7.pdl
Show inline comments
 
@@ -50,7 +50,7 @@ composite puzzle(in[] a, in[] b, out x) {
 

	
 
primitive resolve(in[] a, in[] b, out x) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			int i = 0;
 
			while (i < a.length && i < b.length) {
 
				if (fires(a[i]) && fires(b[i])) {
 
@@ -67,7 +67,7 @@ primitive resolve(in[] a, in[] b, out x) {
 

	
 
primitive async(in[] a) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			int i = 0;
 
			int j = 0;
 
			while (i < a.length) {
testdata/parser/positive/8.pdl
Show inline comments
 
@@ -31,7 +31,7 @@ composite main(out x) {
 

	
 
primitive evil_or_odious(in x, out y) {
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (fires(x) && fires(y)) {
 
				msg a = get(x);
 
				msg result = create(1);
 
@@ -53,7 +53,7 @@ primitive evil_or_odious(in x, out y) {
 
primitive recorder(out h, in a) {
 
	msg c = create(0);
 
	while (true) {
 
		synchronous {
 
		sync {
 
			if (fires(h) && fires(a)) {
 
				put(h, c);
 
				{
testdata/parser/positive/tarry.pdl
Show inline comments
 
@@ -43,7 +43,7 @@ primitive initiator(in start, out end, in[] peeri, out[] peero) {
 
	while (true) {
 
		// Step 1. Initiator waits for token
 
		while (token == null) {
 
			synchronous {
 
			sync {
 
				if (fires(start)) {
 
					token = get(start);
 
				}
 
@@ -59,7 +59,7 @@ primitive initiator(in start, out end, in[] peeri, out[] peero) {
 
			int idx = 0;
 
			// Select first channel that accepts our token
 
			while (token != null) {
 
				synchronous {
 
				sync {
 
					int i = 0;
 
					while (i < neighboro.length) {
 
						if (fires(neighboro[i])) {
 
@@ -78,7 +78,7 @@ primitive initiator(in start, out end, in[] peeri, out[] peero) {
 
			neighboro = neighboro[0:idx] @ neighboro[idx:neighboro.length];
 
			// Step 3. Await return of token
 
			while (token == null) {
 
				synchronous {
 
				sync {
 
					int i = 0;
 
					while (i < peeri.length + neighbori.length) {
 
						if (fires(peeri@neighbori[i])) {
 
@@ -91,7 +91,7 @@ primitive initiator(in start, out end, in[] peeri, out[] peero) {
 
		}
 
		// Step 4. Token is back and all neighbors visited
 
		while (token != null) {
 
			synchronous {
 
			sync {
 
				if (fires(end)) {
 
					put(end, token);
 
					token = null;
 
@@ -111,7 +111,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
		int idx = 0;
 
		// Step 1. Await token for first time
 
		while (token == null) {
 
			synchronous {
 
			sync {
 
				int i = 0;
 
				while (i < peeri.length) {
 
					if (fires(peeri[i])) {
 
@@ -131,7 +131,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
		peero = {};
 
		// Step 2. Non-initiator signals
 
		while (token != null) {
 
			synchronous {
 
			sync {
 
				if (fires(end)) {
 
					put(end, token);
 
					token = null;
 
@@ -139,7 +139,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
			}
 
		}
 
		while (token == null) {
 
			synchronous {
 
			sync {
 
				if (fires(start)) {
 
					token = get(start);
 
				}
 
@@ -150,7 +150,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
			idx = 0;
 
			// Select first channel that accepts our token
 
			while (token != null) {
 
				synchronous {
 
				sync {
 
					int i = 0;
 
					while (i < neighboro.length) {
 
						if (fires(neighboro[i])) {
 
@@ -169,7 +169,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
			neighboro = neighboro[0:idx] @ neighboro[idx:neighboro.length];
 
			// Step 4. Await return of token
 
			while (token == null) {
 
				synchronous {
 
				sync {
 
					int i = 0;
 
					while (i < peeri.length + neighbori.length) {
 
						if (fires(peeri@neighbori[i])) {
 
@@ -182,7 +182,7 @@ primitive noninitiator(out start, in end, in[] peeri, out[] peero) {
 
		}
 
		// Step 5. Token is back, pass to parent
 
		while (token != null) {
 
			synchronous {
 
			sync {
 
				if (fires(parento[0])) {
 
					put(parento[0], token);
 
					token = null;
0 comments (0 inline, 0 general)