diff --git a/bin-compiler/src/main.rs b/bin-compiler/src/main.rs index 35b337b9ab642a23aeb3e0288a5298a172c9d675..83a996cde240e028973856bac8e09c1fbe0a1713 100644 --- a/bin-compiler/src/main.rs +++ b/bin-compiler/src/main.rs @@ -110,4 +110,5 @@ fn main() { println!("Success"); println!("Now running until all components have exited"); + println!("--------------------------------------------\n\n"); } \ No newline at end of file diff --git a/testdata/basic-modules/consumer.pdl b/testdata/basic-modules/consumer.pdl new file mode 100644 index 0000000000000000000000000000000000000000..ccaf12cf83958ecccc7eed5abdd616f83793f013 --- /dev/null +++ b/testdata/basic-modules/consumer.pdl @@ -0,0 +1,10 @@ +#module consumer + +primitive consumer(in input) { + sync { + print("C: going to receive a value"); + auto v = get(input); + print("C: I have received a value"); + } + print("C: I am now exiting"); +} \ No newline at end of file diff --git a/testdata/basic-modules/main.pdl b/testdata/basic-modules/main.pdl new file mode 100644 index 0000000000000000000000000000000000000000..0c2b7f8c50c7d568047f1681b1f81c4aa5a6449b --- /dev/null +++ b/testdata/basic-modules/main.pdl @@ -0,0 +1,8 @@ +import consumer as c; +import producer::producer; + +composite main() { + channel output -> input; + new c::consumer(input); + new producer(output); +} \ No newline at end of file diff --git a/testdata/basic-modules/producer.pdl b/testdata/basic-modules/producer.pdl new file mode 100644 index 0000000000000000000000000000000000000000..d6ddac2d2c79cb98ca95a9768ceb67f1fd551450 --- /dev/null +++ b/testdata/basic-modules/producer.pdl @@ -0,0 +1,11 @@ +#module producer + +primitive producer(out output) { + print("P: Going to send a value"); + sync { + print("P: Going to send a value!"); + put(output, 1337); + print("P: I just sent a value!"); + } + print("P: I am exiting"); +} \ No newline at end of file diff --git a/testdata/basic-modules/readme.txt b/testdata/basic-modules/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..683d7494e9093fd24b753ef2563e7c717d440fa4 --- /dev/null +++ b/testdata/basic-modules/readme.txt @@ -0,0 +1,3 @@ +Run as: + +./bin-compiler -i ./testdata/basic-modules/consumer.pdl -i ./testdata/basic-modules/producer.pdl -i ./testdata/basic-modules/main.pdl \ No newline at end of file diff --git a/testdata/basic/readme.txt b/testdata/basic/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..98b0e4bb33bb44a5005fc3febbf0930efc505fbd --- /dev/null +++ b/testdata/basic/readme.txt @@ -0,0 +1,3 @@ +Run as: + +./bin-compiler -i ./testdata/basic-modules/testing.pdl \ No newline at end of file diff --git a/testdata/basic/testing.pdl b/testdata/basic/testing.pdl new file mode 100644 index 0000000000000000000000000000000000000000..9f450bf50e752fe2872a5b109c804e8fd84472b2 --- /dev/null +++ b/testdata/basic/testing.pdl @@ -0,0 +1,24 @@ +primitive consumer(in input) { + sync { + print("C: going to receive a value"); + auto v = get(input); + print("C: I have received a value"); + } + print("C: I am now exiting"); +} + +primitive producer(out output) { + print("P: Going to send a value"); + sync { + print("P: Going to send a value!"); + put(output, 1337); + print("P: I just sent a value!"); + } + print("P: I am exiting"); +} + +composite main() { + channel output -> input; + new consumer(input); + new producer(output); +} \ No newline at end of file diff --git a/testdata/eval/positive/1.pdl b/testdata/eval/positive/1.pdl deleted file mode 100644 index 4259004f787203b44a41ab6f49b7d3faa2a5a3ae..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/1.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - int x = 5; - x++; - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/1.txt b/testdata/eval/positive/1.txt deleted file mode 100644 index 62f9457511f879886bb7728c986fe10b0ece6bcb..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/1.txt +++ /dev/null @@ -1 +0,0 @@ -6 \ No newline at end of file diff --git a/testdata/eval/positive/10.pdl b/testdata/eval/positive/10.pdl deleted file mode 100644 index f96f3641df1a8aaafe46460e50616dca0989158e..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/10.pdl +++ /dev/null @@ -1,8 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg x = create(0); - return x == null; -} \ No newline at end of file diff --git a/testdata/eval/positive/10.txt b/testdata/eval/positive/10.txt deleted file mode 100644 index 02e4a84d62c4b0fe9cca60bba7b9799f78f1f7ed..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/10.txt +++ /dev/null @@ -1 +0,0 @@ -false \ No newline at end of file diff --git a/testdata/eval/positive/11.pdl b/testdata/eval/positive/11.pdl deleted file mode 100644 index 44592c324ce8346f88413f996134fe78d2148e53..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/11.pdl +++ /dev/null @@ -1,8 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg x = create(0); - return x.length == 0 && (x != null || (x[0] = 1) == 1); -} \ No newline at end of file diff --git a/testdata/eval/positive/11.txt b/testdata/eval/positive/11.txt deleted file mode 100644 index f32a5804e292d30bedf68f62d32fb75d87e99fd9..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/11.txt +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/testdata/eval/positive/2.pdl b/testdata/eval/positive/2.pdl deleted file mode 100644 index 681755ccbd90b04470a775ae7832e94f94ec4533..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/2.pdl +++ /dev/null @@ -1,12 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - int x = 5; - if (x < 5) { - x = --x; - } - x++; - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/2.txt b/testdata/eval/positive/2.txt deleted file mode 100644 index 62f9457511f879886bb7728c986fe10b0ece6bcb..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/2.txt +++ /dev/null @@ -1 +0,0 @@ -6 \ No newline at end of file diff --git a/testdata/eval/positive/3.pdl b/testdata/eval/positive/3.pdl deleted file mode 100644 index fd442115c3c35db488ba0c5c4554b589d4a73104..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/3.pdl +++ /dev/null @@ -1,13 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - int x = 5; - if (x >= 5) { // true - int y = 2; - x -= --y; // --y is 1, so x -= 1 results in 4 - } - x++; // becomes 5 - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/3.txt b/testdata/eval/positive/3.txt deleted file mode 100644 index 7813681f5b41c028345ca62a2be376bae70b7f61..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/3.txt +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/testdata/eval/positive/4.pdl b/testdata/eval/positive/4.pdl deleted file mode 100644 index b085c1e190fc0b5055c3f83c27036321c2adc923..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/4.pdl +++ /dev/null @@ -1,12 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - int x = 5; - while (x < 10) { - x += 2; - if (x == 10) return x; // never taken - } - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/4.txt b/testdata/eval/positive/4.txt deleted file mode 100644 index 9d607966b721abde8931ddd052181fae905db503..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/4.txt +++ /dev/null @@ -1 +0,0 @@ -11 \ No newline at end of file diff --git a/testdata/eval/positive/5.pdl b/testdata/eval/positive/5.pdl deleted file mode 100644 index 1642e91304f0d026f706663e59e1e3fca896f4e2..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/5.pdl +++ /dev/null @@ -1,19 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - int x = 5; -l: while (x < 10) { - if (x % 2 == 0) { - x += 1; // if even, add one, making it odd - } else { - x += 3; // if odd, add three, making it even - } - } - if (x > 10) { - x -= 10; // keep under 10 - goto l; - } - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/5.txt b/testdata/eval/positive/5.txt deleted file mode 100644 index 9a037142aa3c1b4c490e1a38251620f113465330..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/5.txt +++ /dev/null @@ -1 +0,0 @@ -10 \ No newline at end of file diff --git a/testdata/eval/positive/6.pdl b/testdata/eval/positive/6.pdl deleted file mode 100644 index aa7186ef07c9aebf79a3657c590158d42eb47af6..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/6.pdl +++ /dev/null @@ -1,13 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg x = create(5); - x[0] = 1; - x[1] = 2; - x[2] = 3; - x[3] = 4; - x[4] = 5; - return x; -} \ No newline at end of file diff --git a/testdata/eval/positive/6.txt b/testdata/eval/positive/6.txt deleted file mode 100644 index 16e83a29e649922efaf0950ebfbb40e7e8fe54f1..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/6.txt +++ /dev/null @@ -1 +0,0 @@ -#msg(5;1,2,3,4,5) \ No newline at end of file diff --git a/testdata/eval/positive/7.pdl b/testdata/eval/positive/7.pdl deleted file mode 100644 index 8c6d75754b0b75237b8893b9e1ef7bdf02280cdb..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/7.pdl +++ /dev/null @@ -1,13 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg x = create(5); - x[0] = 1; - x[1] = 2; - x[2] = 3; - x[3] = 4; - x[4] = 5; - return x[x[x[x[x[0]]]]]; -} \ No newline at end of file diff --git a/testdata/eval/positive/7.txt b/testdata/eval/positive/7.txt deleted file mode 100644 index 7813681f5b41c028345ca62a2be376bae70b7f61..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/7.txt +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/testdata/eval/positive/8.pdl b/testdata/eval/positive/8.pdl deleted file mode 100644 index efb4940a9dc9ef453e9b113866b3216af2ae0d6a..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/8.pdl +++ /dev/null @@ -1,12 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg x = create(4); - x[0] = 1; - x[1] = 2; - x[2] = 3; - x[3] = 4; - return x.length; -} \ No newline at end of file diff --git a/testdata/eval/positive/8.txt b/testdata/eval/positive/8.txt deleted file mode 100644 index bf0d87ab1b2b0ec1a11a3973d2845b42413d9767..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/8.txt +++ /dev/null @@ -1 +0,0 @@ -4 \ No newline at end of file diff --git a/testdata/eval/positive/9.pdl b/testdata/eval/positive/9.pdl deleted file mode 100644 index 901050c0282ac503ed5d21307883be10f1e8c1a6..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/9.pdl +++ /dev/null @@ -1,12 +0,0 @@ -#version 100 - -composite main() {} - -int test() { - msg[] x = {create(4)}; - x[0][0] = 0; - x[x[0][0]][1] = 1; - x[x[0][0]][x[0][1]+x[0][1]] = 2; - x[x[0][0]][3] = 3; - return x.length + x[0].length + x[x[0][0]][x[0][3]]; -} \ No newline at end of file diff --git a/testdata/eval/positive/9.txt b/testdata/eval/positive/9.txt deleted file mode 100644 index 301160a93062df23030a69f4b5e4d9bf71866ee9..0000000000000000000000000000000000000000 --- a/testdata/eval/positive/9.txt +++ /dev/null @@ -1 +0,0 @@ -8 \ No newline at end of file diff --git a/testdata/parser/counterexamples/arity_checking.pdl b/testdata/parser/counterexamples/arity_checking.pdl deleted file mode 100644 index 7a54b6d63de3491a39758dbc4cd4bb4d23cab59f..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/arity_checking.pdl +++ /dev/null @@ -1,17 +0,0 @@ - -int funcy() { - return 5; -} - -int funcadelic(int a) { - return a; -} - -int caller() { - funcy(); - funcy(1); - funcy(1, 2, 3); - funcadelic(); - funcadelic(5); - return funcadelic(1, 2, 3); -} diff --git a/testdata/parser/counterexamples/declaration_after_function_call.pdl b/testdata/parser/counterexamples/declaration_after_function_call.pdl deleted file mode 100644 index 58608c9734a50692e8170fbedeb2884845ee3953..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/declaration_after_function_call.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 1 -// My bad: C-ism of declarations on top - -int func_b() { - return 5; -} - -int func_a() { - int a = 2; int b = 3; - int c = 5; func_b(c); - int e = 3; - - return b; -} diff --git a/testdata/parser/counterexamples/definition_order.pdl b/testdata/parser/counterexamples/definition_order.pdl deleted file mode 100644 index 927ff6288e1b337eae33e23d51d97d1823853dcf..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/definition_order.pdl +++ /dev/null @@ -1,18 +0,0 @@ -#version 1 -// My bad: C-ism of declarations on top - -int call_me(int later) { - return later; -} - -int function() { - int a = 2; - int b = 3; - - int d = call_me(b); // succeeds, because of assignment - call_me(b); // bare function call seems to work, unless we perform assignment afterwards - - int d = 5; - - return 2; -} \ No newline at end of file diff --git a/testdata/parser/counterexamples/empty_file_reporting.pdl b/testdata/parser/counterexamples/empty_file_reporting.pdl deleted file mode 100644 index 551a12f5c13dddb97d085090fdcebdb6bd0ea92a..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/empty_file_reporting.pdl +++ /dev/null @@ -1,2 +0,0 @@ -// This seems silly, but should be more neatly reported -#version 1 \ No newline at end of file diff --git a/testdata/parser/counterexamples/function_type_checks.pdl b/testdata/parser/counterexamples/function_type_checks.pdl deleted file mode 100644 index 0a74967c96162835f604e14075883c69dbbbc9ad..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/function_type_checks.pdl +++ /dev/null @@ -1,19 +0,0 @@ -// Note sure if this is allowed. It seems silly, but could be useful to -// select ports to return from. In any case, we are returning an out port from -// a function returning an in port - -#version 1 - -in do_something(in a, out b) { - return b; -} - -float another_something(in a) { - return a; -} - -whatami yet_another_one(andwhatismypurpose a) { - return a; -} - -composite main() {} diff --git a/testdata/parser/counterexamples/import_bad_reporting.pdl b/testdata/parser/counterexamples/import_bad_reporting.pdl deleted file mode 100644 index e5b69eff3b009d8d5cd580c66234a4aba893b4ec..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/import_bad_reporting.pdl +++ /dev/null @@ -1,10 +0,0 @@ -// Bad reporting of EOF. Also main parser loop would be fine if pragmas, imports -// and declarations are mixed. Maybe force pragmas at top for readability... - -#version 1 - -composite main() {} - -#version 2 - -composite another() {} \ No newline at end of file diff --git a/testdata/parser/counterexamples/import_stmt.pdl b/testdata/parser/counterexamples/import_stmt.pdl deleted file mode 100644 index 66df1e201b7e1b007aa50f730142d3cece726fa1..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/import_stmt.pdl +++ /dev/null @@ -1,6 +0,0 @@ -// Import succeeds due to bad parsing (checking for characters, not numbers, -// should expect whitespace, then a single number - -#version123 456 - -composite main() {} diff --git a/testdata/parser/counterexamples/integer_specification.pdl b/testdata/parser/counterexamples/integer_specification.pdl deleted file mode 100644 index 07c1185d7efddc971274d205eb72edbbc8a28bbf..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/integer_specification.pdl +++ /dev/null @@ -1,10 +0,0 @@ -#version 1 - -int check_integer_specs() { - int a = 0xFF; - // no octal support, but thats fine - int b = 0xxxxFF; - int c = 0x1x2X3x4X5x6X7x8X; // Wut - int d = 1FF; - return a; -} \ No newline at end of file diff --git a/testdata/parser/counterexamples/multiple_versions.pdl b/testdata/parser/counterexamples/multiple_versions.pdl deleted file mode 100644 index 59a7b30d9440295e30f8731eb62725e52411e125..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/multiple_versions.pdl +++ /dev/null @@ -1,4 +0,0 @@ -#version 1 -#version 2 - -composite main() {} diff --git a/testdata/parser/counterexamples/out_of_order_assignment.pdl b/testdata/parser/counterexamples/out_of_order_assignment.pdl deleted file mode 100644 index f74fa1d52f71d2269055730b4c3ddb81b62cd6ac..0000000000000000000000000000000000000000 --- a/testdata/parser/counterexamples/out_of_order_assignment.pdl +++ /dev/null @@ -1,7 +0,0 @@ -// It fails, so that is nice, but it fails due to the wrong reasons -// My bad: C-ism of declarations on top -bool some_function() { - result_c = false; - bool result_c = true; - return result_c; -} \ No newline at end of file diff --git a/testdata/parser/negative/1.pdl b/testdata/parser/negative/1.pdl deleted file mode 100644 index 22648169831112ea824afff2a7d564c8169f3c4f..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/1.pdl +++ /dev/null @@ -1,10 +0,0 @@ -#version 100 - -// sync block nested twice in primitive -primitive main(in a, out b) { - while (true) { - sync { - sync {} - } - } -} diff --git a/testdata/parser/negative/1.txt b/testdata/parser/negative/1.txt deleted file mode 100644 index 784143a9e09e5acfb1c00417753d1a3d510bf961..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/1.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 1.pdl:7:4: Illegal nested synchronous statement - sync {} - ^ diff --git a/testdata/parser/negative/10.pdl b/testdata/parser/negative/10.pdl deleted file mode 100644 index 5aad08d66854192cd6250258dee63a4fbdb61249..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/10.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 100 - -// sync block nested in sync block -primitive main(in a, out b) { - while (true) { - sync { - if (false || true) { - sync { - skip; - } - } - } - } -} diff --git a/testdata/parser/negative/10.txt b/testdata/parser/negative/10.txt deleted file mode 100644 index 5d5e749c38785814f5ba186420ab90b45fddafa3..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/10.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 10.pdl:8:5: Illegal nested synchronous statement - sync { - ^ diff --git a/testdata/parser/negative/12.pdl b/testdata/parser/negative/12.pdl deleted file mode 100644 index fc8d136b2c35e1ce36ab1b85a5814f64b57c1a8b..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/12.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -// illegal node declaration -primitive main(in a, out b) { - while (true) { - channel x -> y; - sync {} - } -} diff --git a/testdata/parser/negative/12.txt b/testdata/parser/negative/12.txt deleted file mode 100644 index 20ad8c4be5e80c3022c57c4783a34c7709dd9c77..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/12.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 12.pdl:6:3: Illegal channel delcaration - channel x -> y; - ^ diff --git a/testdata/parser/negative/13.pdl b/testdata/parser/negative/13.pdl deleted file mode 100644 index cde45e52b256e23b8a7fd07ea66fa353267514a9..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/13.pdl +++ /dev/null @@ -1,20 +0,0 @@ -#version 100 - -// function statement must return -int myfun(int x) { - if (x > 0) { - while (x > 0) { - x--; - if (x == 0) skip; // illegal! - else return x; - } - } else { - int y = 0; -label: if (y >= 0) { - goto label; - } else { - y = 5; - return myfun(x + 1); - } - } -} diff --git a/testdata/parser/negative/13.txt b/testdata/parser/negative/13.txt deleted file mode 100644 index e3dc7b18f329a5303a00270962226dc2c67e6f25..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/13.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 13.pdl:8:16: Function definition must return - if (x == 0) skip; // illegal! - ^ diff --git a/testdata/parser/negative/14.pdl b/testdata/parser/negative/14.pdl deleted file mode 100644 index 9d9074ee79de1035911d73b683ed6dc97a3d391f..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/14.pdl +++ /dev/null @@ -1,7 +0,0 @@ -#version 100 - -// illegal builtin -composite main(in a, out b) { - int x = get(a); - skip; -} \ No newline at end of file diff --git a/testdata/parser/negative/14.txt b/testdata/parser/negative/14.txt deleted file mode 100644 index c6f809c03644be0ae111bc83b2592f2e2b0823c9..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/14.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 14.pdl:5:10: Illegal built-in occurrence - int x = get(a); - ^ diff --git a/testdata/parser/negative/17.pdl b/testdata/parser/negative/17.pdl deleted file mode 100644 index 28b1bd0f9f9ebd0b8ea3870edc4c37851a591e3a..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/17.pdl +++ /dev/null @@ -1,8 +0,0 @@ -#version 100 - -// illegal assignment -primitive main(in a, out b) { - int x = 0; - int y = 0; - x + y = 0; -} \ No newline at end of file diff --git a/testdata/parser/negative/17.txt b/testdata/parser/negative/17.txt deleted file mode 100644 index a900a293c64892c8ad668d72471ad85d1a6a420d..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/17.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 17.pdl:7:4: Unassignable expression - x + y = 0; - ^ diff --git a/testdata/parser/negative/18.pdl b/testdata/parser/negative/18.pdl deleted file mode 100644 index a49586c8dad897d6180d6c8c6fb12ba8728a4166..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/18.pdl +++ /dev/null @@ -1,8 +0,0 @@ -#version 100 - -// illegal subject -primitive main(in a, out b) { - int x = 0; - int[] y = {x, x, x}; - y[0] = (x+y)[0]; -} \ No newline at end of file diff --git a/testdata/parser/negative/18.txt b/testdata/parser/negative/18.txt deleted file mode 100644 index ada41541886229d2f5b288bfda713d5c92eaf328..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/18.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 18.pdl:7:11: Unindexable expression - y[0] = (x+y)[0]; - ^ diff --git a/testdata/parser/negative/19.pdl b/testdata/parser/negative/19.pdl deleted file mode 100644 index 583cf1896967b4845e438b8672005c2839d73fa4..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/19.pdl +++ /dev/null @@ -1,13 +0,0 @@ -#version 100 - -primitive main(in a) { - while (true) { - sync { - if (fires(a)) { - return 5; - } else { - block(a); - } - } - } -} \ No newline at end of file diff --git a/testdata/parser/negative/19.txt b/testdata/parser/negative/19.txt deleted file mode 100644 index aa5cb7039c66681204d2465a399bb6bdc03c2f6d..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/19.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 19.pdl:7:5: Component definition must not return - return 5; - ^ diff --git a/testdata/parser/negative/2.pdl b/testdata/parser/negative/2.pdl deleted file mode 100644 index f23f1298b182c2f01b0be40ba8127f3a8d3c0b31..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/2.pdl +++ /dev/null @@ -1,10 +0,0 @@ -#version 100 - -// duplicate procedures -composite main(in a, out b) { - id(a, d); -} - -primitive main(in a, out b) { - skip; -} diff --git a/testdata/parser/negative/2.txt b/testdata/parser/negative/2.txt deleted file mode 100644 index 8c7f4e2082d58c59766c74d920fbcb7002c9b0c2..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/2.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 2.pdl:8:1: Defined symbol clash: main -primitive main(in a, out b) { -^ diff --git a/testdata/parser/negative/22.pdl b/testdata/parser/negative/22.pdl deleted file mode 100644 index 6c5aca60684cad2332ecb0cf383b993e055fdf9a..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/22.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 100 - -int main(int a) { -dupl: - while (a >= 2) { - a -= 2; -dupl: while (a < 10) { - a++; - if (a % 5 == 0) - break dupl; - } - } - goto dupl; -} \ No newline at end of file diff --git a/testdata/parser/negative/22.txt b/testdata/parser/negative/22.txt deleted file mode 100644 index 2256dd6e96da539dd0930ae936e867af55dff358..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/22.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 22.pdl:7:1: Duplicate label -dupl: while (a < 10) { -^ diff --git a/testdata/parser/negative/23.pdl b/testdata/parser/negative/23.pdl deleted file mode 100644 index a737914568840c723779867c487a772d09b7ee19..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/23.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 100 - -int main(int a) { -outer: - while (a >= 2) { - a -= 2; - while (a < 10) { -unreach: a++; - if (a % 5 == 0) - break outer; - } - } - goto unreach; -} \ No newline at end of file diff --git a/testdata/parser/negative/23.txt b/testdata/parser/negative/23.txt deleted file mode 100644 index 820e916998e4112ddc422f41bc41c2a633ec3fd4..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/23.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 23.pdl:13:7: Unresolved label - goto unreach; - ^ diff --git a/testdata/parser/negative/24.pdl b/testdata/parser/negative/24.pdl deleted file mode 100644 index 8e7ee6e0b969b1fc5a99a9729cb3f6c5b9383fee..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/24.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 100 - -primitive main(in a, out b) { - int x = 0; - int y = 0; - x += y + 5; - y %= x -= 3; - x *= x * x *= 5; - while (true) { - sync { - assert fires(a) == fires(b); - } - } -} \ No newline at end of file diff --git a/testdata/parser/negative/24.txt b/testdata/parser/negative/24.txt deleted file mode 100644 index 5b99ecbf434acc3a8979524a0f480d748a081745..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/24.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 24.pdl:8:9: Unassignable expression - x *= x * x *= 5; - ^ diff --git a/testdata/parser/negative/25.pdl b/testdata/parser/negative/25.pdl deleted file mode 100644 index 621eb43c219cf9628496e49592b7f9a3ca8178e6..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/25.pdl +++ /dev/null @@ -1,11 +0,0 @@ -#version 100 - -primitive main(in a, out b) { - int x = 0; - int y = 0; - while (true) { - synchronous (int x) { // illegal - assert fires(a) == fires(b); - } - } -} \ No newline at end of file diff --git a/testdata/parser/negative/25.txt b/testdata/parser/negative/25.txt deleted file mode 100644 index 770f8b706322074a3e9111379e93ff6092545d22..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/25.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 25.pdl:7:20: Declared variable clash - synchronous (int x) { // illegal - ^ diff --git a/testdata/parser/negative/26.pdl b/testdata/parser/negative/26.pdl deleted file mode 100644 index 315fce8008e1edf815c0bd483e20e9b2cd3cbfb5..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/26.pdl +++ /dev/null @@ -1,5 +0,0 @@ -#version 100 - -primitive main(in a, out b) { - break; // illegal -} \ No newline at end of file diff --git a/testdata/parser/negative/26.txt b/testdata/parser/negative/26.txt deleted file mode 100644 index d878e6e726cb65f38f61ae8d5b7079166b9dd0fb..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/26.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 26.pdl:4:2: Illegal break: no surrounding while statement - break; // illegal - ^ diff --git a/testdata/parser/negative/27.pdl b/testdata/parser/negative/27.pdl deleted file mode 100644 index b6ac49ea5828439c3d5e97afdb39073f6756312c..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/27.pdl +++ /dev/null @@ -1,15 +0,0 @@ -#version 100 - -int main(int a) { - while (a >= 2) { - a -= 2; -dupl: while (a < 10) { - a++; - if (a % 5 == 0) - break dupl; - } - } - skip; -dupl: - while (true) goto dupl; -} \ No newline at end of file diff --git a/testdata/parser/negative/27.txt b/testdata/parser/negative/27.txt deleted file mode 100644 index 2d77c49e26197b389c54f6514875a7b277a3c2ce..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/27.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 27.pdl:6:1: Duplicate label -dupl: while (a < 10) { -^ diff --git a/testdata/parser/negative/28.pdl b/testdata/parser/negative/28.pdl deleted file mode 100644 index b88d510225d8e269a2d0ca02e22d4f15fdcca56b..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/28.pdl +++ /dev/null @@ -1,7 +0,0 @@ -#version 100 - -int main(int a) { - int x = 0; - (x + 5)++; // not assignable - return x; -} \ No newline at end of file diff --git a/testdata/parser/negative/28.txt b/testdata/parser/negative/28.txt deleted file mode 100644 index 89580285f2fba602ae3df5d471ab293c29481eee..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/28.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 28.pdl:5:8: Unassignable expression - (x + 5)++; // not assignable - ^ diff --git a/testdata/parser/negative/29.pdl b/testdata/parser/negative/29.pdl deleted file mode 100644 index 1c28e137265c80749520d69f5a826dbab096e289..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/29.pdl +++ /dev/null @@ -1,7 +0,0 @@ -#version 100 - -int main(int a) { - int[] x = {}; - ++(x[0..5][2 - x[0]].length); // not assignable - return x; -} \ No newline at end of file diff --git a/testdata/parser/negative/29.txt b/testdata/parser/negative/29.txt deleted file mode 100644 index 9cc1cc21214d0c4045d2dd959c1fb5727e5bf4b6..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/29.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 29.pdl:5:25: Unassignable expression - ++(x[0..5][2 - x[0]].length); // not assignable - ^ diff --git a/testdata/parser/negative/3.pdl b/testdata/parser/negative/3.pdl deleted file mode 100644 index b62869969dc222da490e6fed9dd101206864d5d3..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/3.pdl +++ /dev/null @@ -1,11 +0,0 @@ -#version 100 - -// sync block nested deeply in composite -composite main(in a, out b) { - channel x -> y; - while (true) { - sync { - skip; - } - } -} diff --git a/testdata/parser/negative/3.txt b/testdata/parser/negative/3.txt deleted file mode 100644 index d989513aa104beadaff14a695470bbbc13f7c063..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/3.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 3.pdl:7:3: Illegal nested synchronous statement - sync { - ^ diff --git a/testdata/parser/negative/30.pdl b/testdata/parser/negative/30.pdl deleted file mode 100644 index a10bd74e391efaacb23153c4083b9a84144dc3fc..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/30.pdl +++ /dev/null @@ -1,7 +0,0 @@ -#version 100 - -int main(int a) { - int x = 5; - int y = x + 5; - int z = z; // now allowed -} \ No newline at end of file diff --git a/testdata/parser/negative/30.txt b/testdata/parser/negative/30.txt deleted file mode 100644 index 171946064e34d086b770e427e4826d84174f424f..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/30.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 30.pdl:6:13: Unresolved variable - int z = z; // now allowed - ^ diff --git a/testdata/parser/negative/31.pdl b/testdata/parser/negative/31.pdl deleted file mode 100644 index c2415a04268b2000055f88105679cc60b04a9275..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/31.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -primitive main(int a) { - while (true) { - sync { - break; // not allowed - } - } -} \ No newline at end of file diff --git a/testdata/parser/negative/31.txt b/testdata/parser/negative/31.txt deleted file mode 100644 index 12a2a31ea40959e7d0475f821c0b272877b00deb..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/31.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 31.pdl:6:13: Illegal break: synchronous statement escape - break; // not allowed - ^ diff --git a/testdata/parser/negative/32.pdl b/testdata/parser/negative/32.pdl deleted file mode 100644 index 6d7446d6580cc08e873c367ccde51b9697a63667..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/32.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -primitive main(int a) { - loop: { - sync { - goto loop; // not allowed - } - } -} \ No newline at end of file diff --git a/testdata/parser/negative/32.txt b/testdata/parser/negative/32.txt deleted file mode 100644 index 84200c1aa116144af914299e0a5e85bf7043863d..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/32.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 32.pdl:6:13: Illegal goto: synchronous statement escape - goto loop; // not allowed - ^ diff --git a/testdata/parser/negative/4.pdl b/testdata/parser/negative/4.pdl deleted file mode 100644 index 9d34caa72fdaefd46c77bfc59cf8d91b89b38fa8..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/4.pdl +++ /dev/null @@ -1,13 +0,0 @@ -#version 100 - -// built-in outside sync block -primitive main(in a, out b) { - int x = 0; - msg y = create(0); // legal - while (x < 10) { - y = get(a); // illegal - sync { - y = get(a); // legal - } - } -} diff --git a/testdata/parser/negative/4.txt b/testdata/parser/negative/4.txt deleted file mode 100644 index b79ed8d04631163e22ac00d574020f8de1ad9de4..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/4.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 4.pdl:8:7: Illegal built-in occurrence - y = get(a); // illegal - ^ diff --git a/testdata/parser/negative/5.pdl b/testdata/parser/negative/5.pdl deleted file mode 100644 index 555829b8c5f225b6b63eff1081b3749dab0645db..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/5.pdl +++ /dev/null @@ -1,6 +0,0 @@ -#version 100 - -// unresolved component -composite main(in a, out b) { - sync(a, b); -} diff --git a/testdata/parser/negative/5.txt b/testdata/parser/negative/5.txt deleted file mode 100644 index 291dfac63f7640267cda53743c24a2494059f3d1..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/5.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 5.pdl:5:2: Unresolved method - sync(a, b); - ^ diff --git a/testdata/parser/negative/6.pdl b/testdata/parser/negative/6.pdl deleted file mode 100644 index e14397e74e2eb9a777d743bb0ab71782c3b8cfaa..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/6.pdl +++ /dev/null @@ -1,8 +0,0 @@ -#version 100 - -import std.reo; - -// duplicate formal parameters -composite main(in a, out a) { - new sync_component(a, a); -} diff --git a/testdata/parser/negative/6.txt b/testdata/parser/negative/6.txt deleted file mode 100644 index ad0990bd36ea84ed546ff9df09b8d40b3f1e4ef1..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/6.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 6.pdl:6:26: Declared variable clash -composite main(in a, out a) { - ^ diff --git a/testdata/parser/negative/7.pdl b/testdata/parser/negative/7.pdl deleted file mode 100644 index 6dc6bee31260777ad45fad4e26eef61e3d43224b..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/7.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -import std.reo; - -// shadowing formal parameter -composite main(in a, out b) { - channel c -> a; - new sync_component(a, b); -} diff --git a/testdata/parser/negative/7.txt b/testdata/parser/negative/7.txt deleted file mode 100644 index b70d27ae99446d727ad7a7e73e7911f51ff07ccd..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/7.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 7.pdl:7:15: Declared variable clash - channel c -> a; - ^ diff --git a/testdata/parser/negative/8.pdl b/testdata/parser/negative/8.pdl deleted file mode 100644 index 7adf05b4d5063b151a358fb367edf3ab2ef78961..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/8.pdl +++ /dev/null @@ -1,20 +0,0 @@ -#version 100 - -import std.reo; - -composite main(in a, out b) { - channel c -> d; - syncdrain(a, b); -} - -// shadowing import -primitive syncdrain(in a, in b) { - while (true) { - sync { - if (!fires(a) || !fires(b)) { - block(a); - block(b); - } - } - } -} diff --git a/testdata/parser/negative/8.txt b/testdata/parser/negative/8.txt deleted file mode 100644 index dcd940f242d739124eae55dd86db74510fff1943..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/8.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 8.pdl:11:1: Defined symbol clash: syncdrain -primitive syncdrain(in a, in b) { -^ diff --git a/testdata/parser/negative/9.pdl b/testdata/parser/negative/9.pdl deleted file mode 100644 index 8d39b6ae5ffaaed68173748de342f266cae9599e..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/9.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -// node declaration deeply nested in primitive -primitive main(in a, out b) { - while (true) { - channel yo -> yi; - skip; - } -} diff --git a/testdata/parser/negative/9.txt b/testdata/parser/negative/9.txt deleted file mode 100644 index 96c258e43b702a2806a73fc182ca7b2de70cd214..0000000000000000000000000000000000000000 --- a/testdata/parser/negative/9.txt +++ /dev/null @@ -1,3 +0,0 @@ -Parse error at 9.pdl:6:3: Illegal channel delcaration - channel yo -> yi; - ^ diff --git a/testdata/parser/positive/1.pdl b/testdata/parser/positive/1.pdl deleted file mode 100644 index 725f98df28b34b207f823d46141a845dc0e75cac..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/1.pdl +++ /dev/null @@ -1,93 +0,0 @@ -#version 100 - -composite main(in asend, out arecv, in bsend, out brecv) { - channel xo -> xi; - channel yo -> yi; - new replicator(asend, xo, brecv); - new replicator(bsend, yo, arecv); - // x fires first, then y, then x, et cetera - new sequencer(xi, yi); -} - -primitive replicator(in a, out b, out c) { - while (true) { - sync { - if (fires(a) && fires(b) && fires(c)) { - msg x = get(a); - put(b, x); - put(c, x); - } else { - assert !fires(a) && !fires(b) && !fires(c); - } - } - } -} - -composite sequencer(in x, in y) { - channel ao -> ai; - channel bo -> bi; - channel co -> ci; - channel do -> di; - channel eo -> ei; - channel fo -> fi; - new syncdrain(x, ai); - new syncdrain(y, bi); - new replicator(ei, ao, co); - new replicator(fi, bo, do); - new fifo(ci, fo, null); - new fifo(di, eo, create(0)); -} - -primitive syncdrain(in a, in b) { - while (true) { - sync { - if (fires(a) && fires(b)) { - get(a); - get(b); - } else { - assert !fires(a) && !fires(b); - } - } - } -} - -primitive fifo(in a, out b, msg init) { - msg c = init; - while (true) { - sync { - if (c != null) { - assert !fires(a); - if (fires(b)) { - put(b, c); - c = null; - } - } else { - assert !fires(b); - if (fires(a)) { - c = get(a); - } - } - } - } -} - -primitive sequencer2(in x, in y) { - while (true) { - boolean b = false; - while (!b) { - sync { - assert !fires(y); - if (fires(x)) - b = true; - } - } - b = false; - while (!b) { - sync { - assert !fires(x); - if (fires(y)) - b = true; - } - } - } -} diff --git a/testdata/parser/positive/10.pdl b/testdata/parser/positive/10.pdl deleted file mode 100644 index 90775a2e3eebce117a5dd01995229ae5d903480b..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/10.pdl +++ /dev/null @@ -1,27 +0,0 @@ -#version 100 - -composite main() {} - -primitive example(in a, out[] b) { - while (true) { - sync { - if (fires(a)) { - int i = 0; - while (i < b.length) { - if (fires(b[i])) { - int j = i + 1; - while (j < b.length) - assert !fires(b[j++]); - break; - } - i++; - } - assert i < b.length; - } else { - int i = 0; - while (i < b.length) - assert !fires(b[i++]); - } - } - } -} \ No newline at end of file diff --git a/testdata/parser/positive/11.pdl b/testdata/parser/positive/11.pdl deleted file mode 100644 index 13f7f57bc2d5afdf5853057957afeab1fc91788a..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/11.pdl +++ /dev/null @@ -1,17 +0,0 @@ -#version 100 - -primitive main(in a, out b) { - msg x = null; - while (x == null) { - sync { - if (fires(a)) - x = get(a); - } - } - while (true) { - sync { - if (fires(b)) - put(b, x); - } - } -} \ No newline at end of file diff --git a/testdata/parser/positive/12.pdl b/testdata/parser/positive/12.pdl deleted file mode 100644 index 8647d44b9249e4d85a23309ec6aa540047e2f247..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/12.pdl +++ /dev/null @@ -1,14 +0,0 @@ -#version 100 - -primitive main(in a, out b) { - int x = 0; - int y = 0; - x += y + 5; - y %= x -= 3; - x *= x * (x *= 5); - while (true) { - sync { - assert fires(a) == fires(b); - } - } -} \ No newline at end of file diff --git a/testdata/parser/positive/13.pdl b/testdata/parser/positive/13.pdl deleted file mode 100644 index 910fb084be3046388f25b474fd5497dcc6460da0..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/13.pdl +++ /dev/null @@ -1,42 +0,0 @@ -#version 100 - -/* -Adaptation of 7.pdl -*/ - -composite main() {} - -composite example(in[] a, in[] b, out x) { - new async(a); - new async(b); - new resolve(a, b, x); -} - -primitive resolve(in[] a, in[] b, out x) { - while (true) { - sync { - int i = 0; - while (i < a.length && i < b.length) { - if (fires(a[i]) && fires(b[i])) { - put(x, create(0)); // send token to x - break; - } - i++; - } - if (i >= a.length || i >= b.length) - assert !fires(x); - } - } -} - -primitive async(in[] a) { - while (true) { - sync { - int i = 0; - while (i < a.length) - if (fires(a[i++])) break; - while (i < a.length) - assert !fires(a[i++]); - } - } -} diff --git a/testdata/parser/positive/14.pdl b/testdata/parser/positive/14.pdl deleted file mode 100644 index 4ac063f5521d7f24c3f260fcc067f10783792209..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/14.pdl +++ /dev/null @@ -1,35 +0,0 @@ -#version 100 - -composite main(out c) { - channel ao -> ai; - channel bo -> bi; - new sync_component(ai, bo); - new binary_replicator(bi, ao, c); -} - -primitive sync(in a, out b) { - while (true) { - sync { - if (fires(a) && fires(b)) { - msg x = get(a); - put(b, x); - } else { - assert !fires(a) && !fires(b); - } - } - } -} - -primitive binary_replicator(in b, out a, out c) { - while (true) { - sync { - if (fires(b) && fires(a) && fires(c)) { - msg x = get(b); - put(a, x); - put(c, x); - } else { - assert !fires(a) && !fires(b) && !fires(c); - } - } - } -} diff --git a/testdata/parser/positive/15.pdl b/testdata/parser/positive/15.pdl deleted file mode 100644 index b01b83017d78daa2452998ad67b8ea4408244bec..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/15.pdl +++ /dev/null @@ -1,28 +0,0 @@ -#version - -import std.reo; - -composite main(out c) { - channel ao -> ai; - channel bo -> bi; - channel axo -> axi; - channel zo -> zi; - new sync_component(ai, bo); - new replicator(bi, {axo, c}); - new consensus({axi, zi}, ao); - new generator(zo); -} - -primitive generator(out z) { - while (true) { - synchronous (msg x) { - if (x == null) { - put(z, x); - assert !fires(x); - } else { - put(z, x); - assert fires(x); - } - } - } -} diff --git a/testdata/parser/positive/16.pdl b/testdata/parser/positive/16.pdl deleted file mode 100644 index 06d6a4ef972caee119206004cf47bb3cdcab5d7d..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/16.pdl +++ /dev/null @@ -1,37 +0,0 @@ -#version 100 - -composite main() { - channel xo -> xi; - new a(xi); - new c(xo); -} - -primitive a(in x) { - sync { - msg m = get(x); - assert m.length == 5; - assert m[0] == 'h'; - assert m[1] == 'e'; - assert m[2] == 'l'; - assert m[3] == 'l'; - assert m[4] == 'o'; - } -} - -primitive b(out x) { - synchronous (msg m) { - put(x, m); - } -} -// or -primitive c(out x) { - sync { - msg m = create(5); - m[0] = 'h'; - m[1] = 'e'; - m[2] = 'l'; - m[3] = 'l'; - m[4] = 'o'; - put(x, m); - } -} \ No newline at end of file diff --git a/testdata/parser/positive/17.pdl b/testdata/parser/positive/17.pdl deleted file mode 100644 index 36f68933457d82badaa6e40018f542f3f756a062..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/17.pdl +++ /dev/null @@ -1,50 +0,0 @@ -#version 100 - -composite main(in x, out y) { - new prophet(x, y); -} - -primitive prophet(in b, out a) { - msg c = null; - while (true) { - if (c != null) { - sync { - assert !fires(a); - if (fires(b)) { - assert get(b) == c; - c = null; - } - } - } else { - synchronous (msg x) { - assert !fires(b); - if (fires(a)) { - put(a, x); - c = x; - } - } - } - } -} - -primitive fifo(in a, out b, msg init) { - msg c = init; - while (true) { - if (c != null) { - sync { - assert !fires(a); - if (fires(b)) { - put(b, c); - c = null; - } - } - } else { - sync { - assert !fires(b); - if (fires(a)) { - c = get(a); - } - } - } - } -} \ No newline at end of file diff --git a/testdata/parser/positive/18.pdl b/testdata/parser/positive/18.pdl deleted file mode 100644 index 1427b45e186abd5cfb8437eb09e37c4402695a75..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/18.pdl +++ /dev/null @@ -1,42 +0,0 @@ -#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); -} diff --git a/testdata/parser/positive/19.pdl b/testdata/parser/positive/19.pdl deleted file mode 100644 index 5eb964bf010b2f0c98471cac62e44d0c81d1160d..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/19.pdl +++ /dev/null @@ -1,11 +0,0 @@ -#version 100 - -composite main() {} - -primitive example(int a) { - sync { - loop: { - goto loop; // allowed - } - } -} \ No newline at end of file diff --git a/testdata/parser/positive/2.pdl b/testdata/parser/positive/2.pdl deleted file mode 100644 index 08c6424301a45f808a1d76f042f2c32144387dd6..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/2.pdl +++ /dev/null @@ -1,29 +0,0 @@ -#version 100 - -import std.reo; - -composite main(in asend, out arecv, in bsend, out brecv, in csend, out crecv) { - channel xo -> xi; - channel yo -> yi; - channel zo -> zi; - // Every synchronous round, at most one message is sent (to determine a global order) - new mymerger(asend, bsend, xo); - new mymerger(csend, xi, yo); - // If a message is sent, it is broadcast to every recipient - new replicator(yi, {arecv, zo}); - new replicator(zi, {brecv, crecv}); -} - -primitive mymerger(in a, in b, out c) { - while (true) { - sync { - if (fires(a) && !fires(b) && fires(c)) { - put(c, get(a)); - } else if (!fires(a) && fires(b) && fires(c)) { - put(c, get(b)); - } else { - assert !fires(a) && !fires(b) && !fires(c); - } - } - } -} diff --git a/testdata/parser/positive/20.pdl b/testdata/parser/positive/20.pdl deleted file mode 100644 index 5b840e4fa1506b1b76ea3230c61ea2db69ff3c71..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/20.pdl +++ /dev/null @@ -1,7 +0,0 @@ -#version 100 - -primitive main(in a) { - int[] x = {1,2,3}; - x[1] = (x[0] < x[2] ? x[1:2] : x[0:1])[0:0][0]; - x[1] = x[1][0:1]; -} \ No newline at end of file diff --git a/testdata/parser/positive/3.pdl b/testdata/parser/positive/3.pdl deleted file mode 100644 index f458ce5c398c5ff7a416c4e4a3577b41fcfbcf0a..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/3.pdl +++ /dev/null @@ -1,57 +0,0 @@ -#version 100 - -import std.reo; - -composite main(in ai, out ao, in bi, out bo, in ci, out co, in di, out do) { - // Three parts: - channel xo -> xi; - { - channel afo -> aii; - channel bfo -> bii; - channel cfo -> cii; - channel dfo -> dii; - // Part 1. Collect all in msgs. - new fifo(ai, afo, null); - new fifo(bi, bfo, null); - new fifo(ci, cfo, null); - new fifo(di, dfo, null); - // Part 2. Compute maximum. - new computeMax(aii, bii, cii, dii, xo); - } - // Part 3. Send maximum to all out msgs, and repeat. - { - channel xxo -> xxi; - channel xxxo -> xxxi; - new replicator(xi, xxo, ao); - new replicator(xxi, xxxo, bo); - new replicator(xxxi, co, do); - } -} - -primitive computeMax(in a, in b, in c, in d, out x) { - while (true) { - sync { - if (fires(a) && fires(b) && fires(c) && fires(d) && fires(x)) { - msg aa = get(a); - msg bb = get(b); - msg cc = get(c); - msg dd = get(d); - uint16_t aaa = aa[0] & aa[1] << 8; - uint16_t bbb = bb[0] & bb[1] << 8; - uint16_t ccc = cc[0] & cc[1] << 8; - uint16_t ddd = dd[0] & dd[1] << 8; - // broadcast message with highest header - uint16_t max = aaa; - if (bbb > max) max = bbb; - if (ccc > max) max = ccc; - if (ddd > max) max = ddd; - if (max == aaa) put(x, aa); - else if (max == bbb) put(x, bb); - else if (max == ccc) put(x, cc); - else if (max == ddd) put(x, dd); - } else { - assert !fires(a) && !fires(b) && !fires(c) && !fires(d) && !fires(x); - } - } - } -} diff --git a/testdata/parser/positive/4.pdl b/testdata/parser/positive/4.pdl deleted file mode 100644 index 9b0df3b2e3d8967e5e6fe21c4131553dd7163513..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/4.pdl +++ /dev/null @@ -1,9 +0,0 @@ -#version 100 - -import std.reo; - -composite main(in a, out b) { - msg x = create(1); - x[0] = 'X'; - new fifo(a, b, x); -} diff --git a/testdata/parser/positive/5.pdl b/testdata/parser/positive/5.pdl deleted file mode 100644 index 3804782f9308b5b139d3e24069ba8ba88f7acf20..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/5.pdl +++ /dev/null @@ -1,20 +0,0 @@ -#version 100 - -import std.reo; -import std.buf; - -primitive main(in a, out b) { - while (true) { - sync { - if (fires(a) && fires(b)) { - msg x = get(a); - short y = readShort(x, 0); - y++; - writeShort(x, 0, y); - put(b, x); - } else { - assert !fires(a) && !fires(b); - } - } - } -} diff --git a/testdata/parser/positive/6.pdl b/testdata/parser/positive/6.pdl deleted file mode 100644 index a9bdfc9f55bac1624572a645d06796ea3adc37fb..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/6.pdl +++ /dev/null @@ -1,89 +0,0 @@ -#version 100 - -composite main(in a1, in a2, in a3, out b1, out b2) { - new reonode({a1, a2, a3}, {b1, b2}); -} - -composite reonode(in[] a, out[] b) { - channel co -> ci; - new merger(a, co); - new replicator(ci, b); -} - -composite replicator(in a, out[] b) { - if (b.length == 0) { - new blocking(a); - } else if (b.length == 1) { - new sync_component(a, b[0]); - } else { - channel xo -> xi; - new binary_replicator(a, b[0], xo); - new replicator(xi, b[1 : b.length - 1]); - } -} -primitive binary_replicator(in a, out b, out c) { - while (true) { - sync { - if (fires(a) && fires(b) && fires(c)) { - msg x = get(a); - put(b, x); - put(c, x); - } else { - assert !fires(a) && !fires(b) && !fires(c); - } - } - } -} -primitive blocking(in a) { - while (true) sync { - assert !fires(a); - } -} - -composite merger(in[] a, out b) { - if (a.length == 0) { - new silent(b); - } else { - in prev = a[0]; - int i = 1; - while (i < a.length) { - channel yi -> yo; - new binary_merger(prev, a[i], yo); - prev = yi; - i++; - } - new sync_component(prev, b); - } -} -primitive binary_merger(in a, in b, out c) { - while (true) { - sync { - if (fires(a) && fires(c)) { - assert !fires(b); - put(c, get(a)); - } else if (fires(b) && fires(c)) { - assert !fires(a); - put(c, get(b)); - } else { - assert !fires(a) && !fires(b) && !fires(c); - } - } - } -} -primitive silent(out a) { - while (true) sync { - assert !fires(a); - } -} - -primitive sync(in a, out b) { - while (true) { - sync { - if (fires(a) && fires(b)) { - put(b, get(a)); - } else { - assert !fires(a) && !fires(b); - } - } - } -} diff --git a/testdata/parser/positive/7.pdl b/testdata/parser/positive/7.pdl deleted file mode 100644 index 8287e88afd2e3b4ca72fec7eb7eb7815b78d8709..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/7.pdl +++ /dev/null @@ -1,82 +0,0 @@ -#version 100 - -/* -Suggested by Benjamin Lion. -Source: http://www.wisdom.weizmann.ac.il/~naor/PUZZLES/compare.html - -Bob comes to Ron, a manager at his company, with a complaint about a -sensitive matter; he asks Ron to keep his identity confidential. A few -months later, Moshe (another manager) tells Ron that someone has -complained to him, also with a confidentiality request, about the same -matter. - -Ron and Moshe would like to determine whether the same person has -complained to each of them, but, if there are two complainers, Ron and -Moshe want to give no information to each other about their identities. - -The protocol typically used in a situation like this one is akin to the -game ``twenty questions,'' but goes by the name of ``delicate -conversational probing.'' Ron might ask Moshe if Moshe's complainer is -male, and if the answer is ``yes'' Moshe might then ask Ron if Ron's -complainer's surname begins with a letter preceding ``M'' in the -alphabet. This goes on until Ron and Moshe have ascertained whether they -have the same person in mind. When they do not, however (particularly -when the first ``no'' occurs late in the game) a great deal of -information may have been exchanged. - -What can Ron and Moshe do in order not leak more information than necessary? - -Here is one of our favorite solutions suggested by Miki Ajtai of the IBM -Almaden Research Center. His proposal is "physical" in the sense that -Ron and Moshe must be together. We need to assume that there is a fairly -small pool of candidates, say twenty. Ron and Moshe obtain twenty -identical containers (perhaps by purchasing disposable cups (paper or -plastic)), arrange them in a line, and write labels in front of each -cup, one for each candidate. Ron then puts a folded slip of paper saying -``Yes'' in the cup of the person who complained to him, and a slip -saying ``No'' in the other nineteen cups. Moshe does the same. Ron and -Moshe then remove the labels, and shuffle the cups at random. They then -look inside the cups to see whether one of them contains two slips -saying ``Yes'' and decide accordingly. -*/ - -composite main() {} - -composite puzzle(in[] a, in[] b, out x) { - new async(a); - new async(b); - new resolve(a, b, x); -} - -primitive resolve(in[] a, in[] b, out x) { - while (true) { - sync { - int i = 0; - while (i < a.length && i < b.length) { - if (fires(a[i]) && fires(b[i])) { - put(x, create(0)); // send token to x - goto end; - } - i++; - } - assert !fires(x); - end: skip; - } - } -} - -primitive async(in[] a) { - while (true) { - sync { - int i = 0; - int j = 0; - while (i < a.length) { - if (fires(a[i])) break; - i++; - } - while (j < a.length) { - assert i == j || !fires(a[j]); - } - } - } -} diff --git a/testdata/parser/positive/8.pdl b/testdata/parser/positive/8.pdl deleted file mode 100644 index 12028358391187f031051c78f9f5e6267ce07a0e..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/8.pdl +++ /dev/null @@ -1,73 +0,0 @@ -#version 100 - -/* -Suggested by Luc Edixhoven. -Source: https://en.wikipedia.org/wiki/Thue%E2%80%93Morse_sequence - -In mathematics, the Thue–Morse sequence, or Prouhet–Thue–Morse sequence, -is the binary sequence (an infinite sequence of 0s and 1s) obtained by -starting with 0 and successively appending the Boolean complement of the -sequence obtained thus far. - -To compute the nth element t_n, write the number n in binary. If the -number of ones in this binary expansion is odd then t_n = 1, if even -then t_n = 0. For this reason John H. Conway et al. call numbers n -satisfying t_n = 1 odious (for odd) numbers and numbers for which -t_n = 0 evil (for even) numbers. In other words, t_n = 0 if n is -an evil number and t_n = 1 if n is an odious number. - -*/ - -import std.reo; - -composite main(out x) { - channel ao -> ai; - channel bo -> bi; - channel co -> ci; - new evil_or_odious(ai, bo); - new replicator(bi, {co, x}); - new recorder(ao, ci); -} - -primitive evil_or_odious(in x, out y) { - while (true) { - sync { - if (fires(x) && fires(y)) { - msg a = get(x); - msg result = create(1); - boolean even = true; - int i = 0; - while (i < a.length) { - if (a[i++] == '1') - even = !even; - } - result[0] = even ? '1' : '0'; - put(y, result); - } else { - assert !fires(x); - assert !fires(y); - } - } - } -} -primitive recorder(out h, in a) { - msg c = create(0); - while (true) { - sync { - if (fires(h) && fires(a)) { - put(h, c); - { - msg x = get(a); - msg n = create(c.length + 1); - int i = 0; - while (i < c.length) { - n[i] = c[i]; - i++; - } - n[c.length] = x[0]; - c = n; - } - } - } - } -} diff --git a/testdata/parser/positive/9.pdl b/testdata/parser/positive/9.pdl deleted file mode 100644 index a72998693c23c3d05efdd822b26d43025828b393..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/9.pdl +++ /dev/null @@ -1,16 +0,0 @@ -#version 100 - -import std.reo; - -composite main(in A, in B, out C) { - channel xo -> xi; - channel yo -> yi; - channel zo -> zi; - channel do -> di; - channel eo -> ei; - new replicator(A, {xo, yo}); - new replicator(B, {zo, do}); - new syncdrain(xi, zi); - new fifo(di, eo); - new merger({yi, ei}, C); -} \ No newline at end of file diff --git a/testdata/parser/positive/tarry.pdl b/testdata/parser/positive/tarry.pdl deleted file mode 100644 index e1ef90cfdaada7279a8a1047037979ebb1033006..0000000000000000000000000000000000000000 --- a/testdata/parser/positive/tarry.pdl +++ /dev/null @@ -1,197 +0,0 @@ -#version 100 - -/* -Example distributed algorithm: Tarry's algorithm. - -A token passes around the network, starting at some initiator. The initiator -starts the algorithm, and when the algorithm ends the token is back again at -the initiator. The non-initiators are signaled when they receive the token -for the first time; when the token is handled traversal continues. - -The network topology is defined by applications: they create an initiator or -non-initiator component, and establish bidirectional channels in between. -In this example, the whole network is created statically for simulation -purposes: there are 4 processes and some channels in between. - -Ports: initiator start, initiator end, three pairs of signals. -*/ - -import std.reo; - -composite main(in start, out end, out s1o, in s1i, out s2o, in s2i, out s3o, in s3i) { - // Processes: p, q, r, s - // Channels: pq, pr, qr, rs - channel p_pq -> pq_q; - channel q_pq -> pq_p; - channel p_pr -> pr_r; - channel r_pr -> pr_p; - channel q_qr -> qr_r; - channel r_qr -> qr_q; - channel r_rs -> rs_s; - channel s_rs -> rs_r; - - new initiator(start, end, {pq_p, pr_p}, {p_pq, p_pr}); - new noninitiator(s1o, s1i, {pq_q, qr_q}, {q_pq, q_qr}); - new noninitiator(s2o, s2i, {pr_r, rs_r}, {r_pr, r_rs}); - new noninitiator(s3o, s3i, {rs_s}, {s_rs}); -} -primitive initiator(in start, out end, in[] peeri, out[] peero) { - msg token = null; - in[] neighbori = {}; - out[] neighboro = {}; - assert peeri.length == peero.length; - while (true) { - // Step 1. Initiator waits for token - while (token == null) { - sync { - if (fires(start)) { - token = get(start); - } - } - } - // Reset neighbors - neighbori = peeri; - peeri = {}; - neighboro = peero; - peero = {}; - // Step 2. Keep sending token to processes - while (neighbori.length > 0) { - int idx = 0; - // Select first channel that accepts our token - while (token != null) { - sync { - int i = 0; - while (i < neighboro.length) { - if (fires(neighboro[i])) { - put(neighboro[i], token); - idx = i; - token = null; - break; - } else i++; - } - } - } - // Eliminate from neighbor set - peeri = {neighbori[idx]} @ peeri; - peero = {neighboro[idx]} @ peero; - neighbori = neighbori[0:idx] @ neighbori[idx:neighbori.length]; - neighboro = neighboro[0:idx] @ neighboro[idx:neighboro.length]; - // Step 3. Await return of token - while (token == null) { - sync { - int i = 0; - while (i < peeri.length + neighbori.length) { - if (fires(peeri@neighbori[i])) { - token = get(peeri@neighbori[i]); - break; - } else i++; - } - } - } - } - // Step 4. Token is back and all neighbors visited - while (token != null) { - sync { - if (fires(end)) { - put(end, token); - token = null; - } - } - } - } -} -primitive noninitiator(out start, in end, in[] peeri, out[] peero) { - msg token = null; - in[] neighbori = {}; - out[] neighboro = {}; - in[] parenti = {}; - out[] parento = {}; - assert peeri.length == peero.length; - while (true) { - int idx = 0; - // Step 1. Await token for first time - while (token == null) { - sync { - int i = 0; - while (i < peeri.length) { - if (fires(peeri[i])) { - token = get(peeri[i]); - idx = i; - break; - } else i++; - } - } - } - // Reset neighbors - neighbori = peeri[0:idx] @ peeri[idx:peeri.length]; - neighboro = peero[0:idx] @ peero[idx:peero.length]; - parenti = {peeri[idx]}; - parento = {peero[idx]}; - peeri = {}; - peero = {}; - // Step 2. Non-initiator signals - while (token != null) { - sync { - if (fires(end)) { - put(end, token); - token = null; - } - } - } - while (token == null) { - sync { - if (fires(start)) { - token = get(start); - } - } - } - // Step 3. Keep sending token to processes - while (neighbori.length > 0) { - idx = 0; - // Select first channel that accepts our token - while (token != null) { - sync { - int i = 0; - while (i < neighboro.length) { - if (fires(neighboro[i])) { - put(neighboro[i], token); - idx = i; - token = null; - break; - } else i++; - } - } - } - // Eliminate from neighbor set - peeri = {neighbori[idx]} @ peeri; - peero = {neighboro[idx]} @ peero; - neighbori = neighbori[0:idx] @ neighbori[idx:neighbori.length]; - neighboro = neighboro[0:idx] @ neighboro[idx:neighboro.length]; - // Step 4. Await return of token - while (token == null) { - sync { - int i = 0; - while (i < peeri.length + neighbori.length) { - if (fires(peeri@neighbori[i])) { - token = get(peeri@neighbori[i]); - break; - } else i++; - } - } - } - } - // Step 5. Token is back, pass to parent - while (token != null) { - sync { - if (fires(parento[0])) { - put(parento[0], token); - token = null; - } - } - } - peeri = {parenti[0]} @ peeri; - peero = {parento[0]} @ peero; - parenti = {}; - parento = {}; - } -}