diff --git a/tests/funcall/2apb.e b/tests/funcall/2apb.e index cad96269408d9e5047b8c51995cc1566630aed40..4ff99d0abc0119cf3adb073cc9f831c9c7ce5c05 100644 --- a/tests/funcall/2apb.e +++ b/tests/funcall/2apb.e @@ -1,6 +1,6 @@ -int main(int argc,char* argv[]){ +main(){ return f(8,3); } -int f(int a,int b){ +f(a, b){ return a + 2 * b; } diff --git a/tests/funcall/2apb.e.expect_14_12_3_8_12 b/tests/funcall/2apb.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..e2ce8007751569ecec00e7bfdaad1980596cc9f4 --- /dev/null +++ b/tests/funcall/2apb.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 14} \ No newline at end of file diff --git a/tests/funcall/2apb.e.expect_1_2_3 b/tests/funcall/2apb.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..e2ce8007751569ecec00e7bfdaad1980596cc9f4 --- /dev/null +++ b/tests/funcall/2apb.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 14} \ No newline at end of file diff --git a/tests/funcall/2apb.e.expect_lexer b/tests/funcall/2apb.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..8197b9b54f27d4f4ea65192dd83bbd9ba99308f0 --- /dev/null +++ b/tests/funcall/2apb.e.expect_lexer @@ -0,0 +1,29 @@ +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(8) +SYM_COMMA +SYM_INTEGER(3) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_INTEGER(2) +SYM_ASTERISK +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/5args.e b/tests/funcall/5args.e index 818871c2bf5d1a76243e3b9695e0a465bad5ca3e..59f7469f03aa1a7c60cf374c0ffdaeb222072458 100644 --- a/tests/funcall/5args.e +++ b/tests/funcall/5args.e @@ -1,8 +1,6 @@ -int main(int argc,char* argv[]){ - int x = atoi(argv[1]); - int y = atoi(argv[2]); +main(x, y){ return f(x,x,y,y,x*2); } -int f(int x,int y,int z,int t,int u){ +f(x, y, z, t, u){ return x + y + z + t + u; } diff --git a/tests/funcall/5args.e.expect_14_12_3_8_12 b/tests/funcall/5args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..e9a8021a60099904d6f192b40d0dda3f401ac4ee --- /dev/null +++ b/tests/funcall/5args.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 80} \ No newline at end of file diff --git a/tests/funcall/5args.e.expect_1_2_3 b/tests/funcall/5args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..61b83a85dd0aeeb0ff59aaeb795875114625cdf7 --- /dev/null +++ b/tests/funcall/5args.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 8} \ No newline at end of file diff --git a/tests/funcall/5args.e.expect_lexer b/tests/funcall/5args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..aeb962429ea2b3bd1a9e5530dd1357efa516e9b5 --- /dev/null +++ b/tests/funcall/5args.e.expect_lexer @@ -0,0 +1,50 @@ +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_COMMA +SYM_IDENTIFIER(x) +SYM_ASTERISK +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_COMMA +SYM_IDENTIFIER(z) +SYM_COMMA +SYM_IDENTIFIER(t) +SYM_COMMA +SYM_IDENTIFIER(u) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_PLUS +SYM_IDENTIFIER(z) +SYM_PLUS +SYM_IDENTIFIER(t) +SYM_PLUS +SYM_IDENTIFIER(u) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/argswap.e b/tests/funcall/argswap.e index f910ae50ff479450ce42bc3b289a13e1de4f9109..615371cc55c3dbe64618f33a58f4557427470bf1 100644 --- a/tests/funcall/argswap.e +++ b/tests/funcall/argswap.e @@ -1,14 +1,13 @@ -int g(int a, int b){ +g(a,b){ print(a); print(b); return (b - a); } -int f(int a, int b){ +f(a,b){ print(a); print(b); return g(b, a); } -int main(int argc, char* argv[]){ - return f(atoi(argv[1]), - atoi(argv[2])); +main(x, y){ + return f(x, y); } diff --git a/tests/funcall/argswap.e.expect_14_12_3_8_12 b/tests/funcall/argswap.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..38f595af3b9b89775ee2efca6d8e1d1496063200 --- /dev/null +++ b/tests/funcall/argswap.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "14\n12\n12\n14\n", "error": null, "retval": 2} \ No newline at end of file diff --git a/tests/funcall/argswap.e.expect_1_2_3 b/tests/funcall/argswap.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..e03517fa033505d7fdef39702e40d4ccf9422e76 --- /dev/null +++ b/tests/funcall/argswap.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "1\n2\n2\n1\n", "error": null, "retval": -1} \ No newline at end of file diff --git a/tests/funcall/argswap.e.expect_lexer b/tests/funcall/argswap.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..2c8a87dc1d273f5d6156be905b62504276797c7b --- /dev/null +++ b/tests/funcall/argswap.e.expect_lexer @@ -0,0 +1,68 @@ +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_MINUS +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/even_more_args.e b/tests/funcall/even_more_args.e index 9e04d35814d66daab0e96866094b7c8f00acd2c8..281e743167c555e3ae446cf66fa4dc6f1329fb59 100644 --- a/tests/funcall/even_more_args.e +++ b/tests/funcall/even_more_args.e @@ -1,27 +1,27 @@ -int f(int a, - int b, - int c, - int d, - int e, - int f, - int g, - int h, - int i, - int j, - int k, - int l, - int m, - int n, - int o, - int p, - int q, - int r, - int s, - int t - ){ +f(a, + b, + c, + d, + e, + f, + g, + h, + i, + j, + k, + l, + m, + n, + o, + p, + q, + r, + s, + t + ){ return (k * (a + b * c + d * e * f + g * h * i * j) + (l + m * n) * o + p * q) * (r + s * t); } -int main(int argc, char* argv[]){ +main(){ return f(1,2,3,4,5,6,7,8,9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); } diff --git a/tests/funcall/even_more_args.e.expect_14_12_3_8_12 b/tests/funcall/even_more_args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1705ac5b63d7e3c645cc187264daf2b0610faa2a --- /dev/null +++ b/tests/funcall/even_more_args.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23887562} \ No newline at end of file diff --git a/tests/funcall/even_more_args.e.expect_1_2_3 b/tests/funcall/even_more_args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..1705ac5b63d7e3c645cc187264daf2b0610faa2a --- /dev/null +++ b/tests/funcall/even_more_args.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23887562} \ No newline at end of file diff --git a/tests/funcall/even_more_args.e.expect_lexer b/tests/funcall/even_more_args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..f29ddb98f2b94092cf4637c0a15b0668e691e092 --- /dev/null +++ b/tests/funcall/even_more_args.e.expect_lexer @@ -0,0 +1,143 @@ +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_IDENTIFIER(c) +SYM_COMMA +SYM_IDENTIFIER(d) +SYM_COMMA +SYM_IDENTIFIER(e) +SYM_COMMA +SYM_IDENTIFIER(f) +SYM_COMMA +SYM_IDENTIFIER(g) +SYM_COMMA +SYM_IDENTIFIER(h) +SYM_COMMA +SYM_IDENTIFIER(i) +SYM_COMMA +SYM_IDENTIFIER(j) +SYM_COMMA +SYM_IDENTIFIER(k) +SYM_COMMA +SYM_IDENTIFIER(l) +SYM_COMMA +SYM_IDENTIFIER(m) +SYM_COMMA +SYM_IDENTIFIER(n) +SYM_COMMA +SYM_IDENTIFIER(o) +SYM_COMMA +SYM_IDENTIFIER(p) +SYM_COMMA +SYM_IDENTIFIER(q) +SYM_COMMA +SYM_IDENTIFIER(r) +SYM_COMMA +SYM_IDENTIFIER(s) +SYM_COMMA +SYM_IDENTIFIER(t) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_LPARENTHESIS +SYM_IDENTIFIER(k) +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_IDENTIFIER(b) +SYM_ASTERISK +SYM_IDENTIFIER(c) +SYM_PLUS +SYM_IDENTIFIER(d) +SYM_ASTERISK +SYM_IDENTIFIER(e) +SYM_ASTERISK +SYM_IDENTIFIER(f) +SYM_PLUS +SYM_IDENTIFIER(g) +SYM_ASTERISK +SYM_IDENTIFIER(h) +SYM_ASTERISK +SYM_IDENTIFIER(i) +SYM_ASTERISK +SYM_IDENTIFIER(j) +SYM_RPARENTHESIS +SYM_PLUS +SYM_LPARENTHESIS +SYM_IDENTIFIER(l) +SYM_PLUS +SYM_IDENTIFIER(m) +SYM_ASTERISK +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_ASTERISK +SYM_IDENTIFIER(o) +SYM_PLUS +SYM_IDENTIFIER(p) +SYM_ASTERISK +SYM_IDENTIFIER(q) +SYM_RPARENTHESIS +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_IDENTIFIER(r) +SYM_PLUS +SYM_IDENTIFIER(s) +SYM_ASTERISK +SYM_IDENTIFIER(t) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(1) +SYM_COMMA +SYM_INTEGER(2) +SYM_COMMA +SYM_INTEGER(3) +SYM_COMMA +SYM_INTEGER(4) +SYM_COMMA +SYM_INTEGER(5) +SYM_COMMA +SYM_INTEGER(6) +SYM_COMMA +SYM_INTEGER(7) +SYM_COMMA +SYM_INTEGER(8) +SYM_COMMA +SYM_INTEGER(9) +SYM_COMMA +SYM_INTEGER(10) +SYM_COMMA +SYM_INTEGER(11) +SYM_COMMA +SYM_INTEGER(12) +SYM_COMMA +SYM_INTEGER(13) +SYM_COMMA +SYM_INTEGER(14) +SYM_COMMA +SYM_INTEGER(15) +SYM_COMMA +SYM_INTEGER(16) +SYM_COMMA +SYM_INTEGER(17) +SYM_COMMA +SYM_INTEGER(18) +SYM_COMMA +SYM_INTEGER(19) +SYM_COMMA +SYM_INTEGER(20) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/f+g.e b/tests/funcall/f+g.e index c50653a769b776655b4add76e4d57a35d39999b8..c88d2f105cbc52cf9a292fc57fca950325ef8d63 100644 --- a/tests/funcall/f+g.e +++ b/tests/funcall/f+g.e @@ -1,10 +1,10 @@ -int f(int x){ +f(x){ return x + 2; } -int g(int y){ +g(y){ return y * 3; } -int main(int argc,char* argv[]){ +main(){ return f(8) + g(5); } diff --git a/tests/funcall/f+g.e.expect_14_12_3_8_12 b/tests/funcall/f+g.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..c24e9b82dd8efe186dc84230615b92ea22fee674 --- /dev/null +++ b/tests/funcall/f+g.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 25} \ No newline at end of file diff --git a/tests/funcall/f+g.e.expect_1_2_3 b/tests/funcall/f+g.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..c24e9b82dd8efe186dc84230615b92ea22fee674 --- /dev/null +++ b/tests/funcall/f+g.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 25} \ No newline at end of file diff --git a/tests/funcall/f+g.e.expect_lexer b/tests/funcall/f+g.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..0ebab59d733398bee18bfc43eba126ccd0270b1a --- /dev/null +++ b/tests/funcall/f+g.e.expect_lexer @@ -0,0 +1,39 @@ +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(y) +SYM_ASTERISK +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(8) +SYM_RPARENTHESIS +SYM_PLUS +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_INTEGER(5) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/f_3.e b/tests/funcall/f_3.e index da963c09f683a1025ebd1cdd8ad98b43af3af0e5..249610c685cf29aa14d10c8c880bd71695de776a 100644 --- a/tests/funcall/f_3.e +++ b/tests/funcall/f_3.e @@ -1,6 +1,6 @@ -int main(int argc,char* argv[]){ +main(){ return f(); } -int f(){ +f(){ return 3; } diff --git a/tests/funcall/f_3.e.expect_14_12_3_8_12 b/tests/funcall/f_3.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/funcall/f_3.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/funcall/f_3.e.expect_1_2_3 b/tests/funcall/f_3.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/funcall/f_3.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/funcall/f_3.e.expect_lexer b/tests/funcall/f_3.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..79b5dd38be2288e4af2b408552eb6e4bd647a346 --- /dev/null +++ b/tests/funcall/f_3.e.expect_lexer @@ -0,0 +1,19 @@ +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/fib.e.expect_14_12_3_8_12 b/tests/funcall/fib.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1fef2374b55b0d9496617cec0a857a07906f799f --- /dev/null +++ b/tests/funcall/fib.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 377} \ No newline at end of file diff --git a/tests/funcall/fib.e.expect_1_2_3 b/tests/funcall/fib.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/funcall/fib.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/funcall/fib.e.expect_lexer b/tests/funcall/fib.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..0782208b0513813fb2852e9bd9fc866737f735a8 --- /dev/null +++ b/tests/funcall/fib.e.expect_lexer @@ -0,0 +1,60 @@ +SYM_IDENTIFIER(fib) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(14) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_LEQ +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(fib) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_PLUS +SYM_IDENTIFIER(fib) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(fib) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/gcdrec.e b/tests/funcall/gcdrec.e index 4bc69ffacd7cb4d82946cfcf379156066a317f8d..0352c550f00faf745024a61c2453ff759cd4fa2d 100644 --- a/tests/funcall/gcdrec.e +++ b/tests/funcall/gcdrec.e @@ -1,12 +1,10 @@ -int gcd(int a,int b){ +gcd(a,b){ if(b == 0){ return a; } else { return gcd(b, a % b); } } -int main(int argc,char* argv[]){ - int a = atoi(argv[1]); - int b = atoi(argv[2]); +main(a, b){ return gcd(a,b); } diff --git a/tests/funcall/gcdrec.e.expect_14_12_3_8_12 b/tests/funcall/gcdrec.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..df1c5a5ba4e1647c7e3409ee9539a3583afa9bdf --- /dev/null +++ b/tests/funcall/gcdrec.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 2} \ No newline at end of file diff --git a/tests/funcall/gcdrec.e.expect_1_2_3 b/tests/funcall/gcdrec.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/funcall/gcdrec.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/funcall/gcdrec.e.expect_lexer b/tests/funcall/gcdrec.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..e02c133dce7fbcd42e08c3b13089813ccf46e656 --- /dev/null +++ b/tests/funcall/gcdrec.e.expect_lexer @@ -0,0 +1,49 @@ +SYM_IDENTIFIER(gcd) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(gcd) +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_IDENTIFIER(a) +SYM_MOD +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(gcd) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/hanoi.e b/tests/funcall/hanoi.e index ee9d72693412e88619e810a8e57b8c5fa79cd950..5b485dae346f5dc479845f289389bf0a9396be3c 100644 --- a/tests/funcall/hanoi.e +++ b/tests/funcall/hanoi.e @@ -1,12 +1,11 @@ -int main(int argc,char* argv[]){ - int ndisque = atoi(argv[1]); +main(ndisque){ return hanoi(ndisque); } -int hanoi(int n) +hanoi(n) { if(n > 0) { - int x = hanoi(n-1); + x = hanoi(n-1); return 1 + 2 * x; } return 0; diff --git a/tests/funcall/hanoi.e.expect_14_12_3_8_12 b/tests/funcall/hanoi.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..7cf52b9a4706e4fab8abce3869595d4e4b3ceb36 --- /dev/null +++ b/tests/funcall/hanoi.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 16383} \ No newline at end of file diff --git a/tests/funcall/hanoi.e.expect_1_2_3 b/tests/funcall/hanoi.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/funcall/hanoi.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/funcall/hanoi.e.expect_lexer b/tests/funcall/hanoi.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..6ba0a1e080ea40b2885bd0d5fc902256e3c46a25 --- /dev/null +++ b/tests/funcall/hanoi.e.expect_lexer @@ -0,0 +1,46 @@ +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_IDENTIFIER(ndisque) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(hanoi) +SYM_LPARENTHESIS +SYM_IDENTIFIER(ndisque) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(hanoi) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(hanoi) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(1) +SYM_PLUS +SYM_INTEGER(2) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/lots_of_args.e b/tests/funcall/lots_of_args.e index 3dc257584ab7467ad25d351671b2e03f050e5971..a8017e107afc88bf6ff4fdd077c2dd2f76dc8a97 100644 --- a/tests/funcall/lots_of_args.e +++ b/tests/funcall/lots_of_args.e @@ -1,17 +1,17 @@ -int f(int a, - int b, - int c, - int d, - int e, - int f, - int g, - int h, - int i, - int j - ){ +f(a, + b, + c, + d, + e, + f, + g, + h, + i, + j + ){ return a + b * c + d * e * f + g * h * i * j; } -int main(int argc, char* argv[]){ +main(){ return f(1,2,3,4,5,6,7,8,9,10); } diff --git a/tests/funcall/lots_of_args.e.expect_14_12_3_8_12 b/tests/funcall/lots_of_args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..16d63e1a7da8f2cb086a0d601046966b4a6c4003 --- /dev/null +++ b/tests/funcall/lots_of_args.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 5167} \ No newline at end of file diff --git a/tests/funcall/lots_of_args.e.expect_1_2_3 b/tests/funcall/lots_of_args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..16d63e1a7da8f2cb086a0d601046966b4a6c4003 --- /dev/null +++ b/tests/funcall/lots_of_args.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 5167} \ No newline at end of file diff --git a/tests/funcall/lots_of_args.e.expect_lexer b/tests/funcall/lots_of_args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..3c28c41facaafa42df0d874122fc48663c301c80 --- /dev/null +++ b/tests/funcall/lots_of_args.e.expect_lexer @@ -0,0 +1,75 @@ +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_IDENTIFIER(c) +SYM_COMMA +SYM_IDENTIFIER(d) +SYM_COMMA +SYM_IDENTIFIER(e) +SYM_COMMA +SYM_IDENTIFIER(f) +SYM_COMMA +SYM_IDENTIFIER(g) +SYM_COMMA +SYM_IDENTIFIER(h) +SYM_COMMA +SYM_IDENTIFIER(i) +SYM_COMMA +SYM_IDENTIFIER(j) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_IDENTIFIER(b) +SYM_ASTERISK +SYM_IDENTIFIER(c) +SYM_PLUS +SYM_IDENTIFIER(d) +SYM_ASTERISK +SYM_IDENTIFIER(e) +SYM_ASTERISK +SYM_IDENTIFIER(f) +SYM_PLUS +SYM_IDENTIFIER(g) +SYM_ASTERISK +SYM_IDENTIFIER(h) +SYM_ASTERISK +SYM_IDENTIFIER(i) +SYM_ASTERISK +SYM_IDENTIFIER(j) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(1) +SYM_COMMA +SYM_INTEGER(2) +SYM_COMMA +SYM_INTEGER(3) +SYM_COMMA +SYM_INTEGER(4) +SYM_COMMA +SYM_INTEGER(5) +SYM_COMMA +SYM_INTEGER(6) +SYM_COMMA +SYM_INTEGER(7) +SYM_COMMA +SYM_INTEGER(8) +SYM_COMMA +SYM_INTEGER(9) +SYM_COMMA +SYM_INTEGER(10) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/funcall/print_and_fun.e b/tests/funcall/print_and_fun.e index 6f6901ab36f21bdba092079f6103bad743356665..0c24e564c78576916578a6c30f60604e6ff9c04c 100644 --- a/tests/funcall/print_and_fun.e +++ b/tests/funcall/print_and_fun.e @@ -1,16 +1,16 @@ -int g(int x){ +g(x){ return x; } -int f(int a, int b){ +f(a, b){ b = g(8); print(a); print(b); return 0; } -int main(int argc, char* argv[]){ +main(){ f(3,4); return 0; } diff --git a/tests/funcall/print_and_fun.e.expect_14_12_3_8_12 b/tests/funcall/print_and_fun.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..7d935d7f4a3630ae710e34b79470872b1124e978 --- /dev/null +++ b/tests/funcall/print_and_fun.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "3\n8\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/funcall/print_and_fun.e.expect_1_2_3 b/tests/funcall/print_and_fun.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..7d935d7f4a3630ae710e34b79470872b1124e978 --- /dev/null +++ b/tests/funcall/print_and_fun.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "3\n8\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/funcall/print_and_fun.e.expect_lexer b/tests/funcall/print_and_fun.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..834218f66d791aed054dec525bb4e0e33596260b --- /dev/null +++ b/tests/funcall/print_and_fun.e.expect_lexer @@ -0,0 +1,53 @@ +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_INTEGER(8) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_COMMA +SYM_INTEGER(4) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF