diff --git a/tests/char/char.e b/tests/char/char.e index c671744d2b2334646fe446b1d535f23004f90f2b..f52c227b94f6d3cfc9df669b094011528ea00b57 100644 --- a/tests/char/char.e +++ b/tests/char/char.e @@ -1,4 +1,4 @@ -int main(int argc,char* argv[]){ +int main(){ char c = 'b'; print_char(c); return c; diff --git a/tests/char/char.e.expect_14_12_3_8_12 b/tests/char/char.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..aaa03baf607257601754afb35ae560c1d767059e --- /dev/null +++ b/tests/char/char.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "b", "error": null, "retval": 98} \ No newline at end of file diff --git a/tests/char/char.e.expect_1_2_3 b/tests/char/char.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..aaa03baf607257601754afb35ae560c1d767059e --- /dev/null +++ b/tests/char/char.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "b", "error": null, "retval": 98} \ No newline at end of file diff --git a/tests/char/char.e.expect_lexer b/tests/char/char.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..770eef32e5b7eb93be87cc77912c41b234a5a107 --- /dev/null +++ b/tests/char/char.e.expect_lexer @@ -0,0 +1,20 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_CHAR +SYM_IDENTIFIER(c) +SYM_ASSIGN +SYM_CHARACTER(b) +SYM_SEMICOLON +SYM_IDENTIFIER(print_char) +SYM_LPARENTHESIS +SYM_IDENTIFIER(c) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(c) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/char/char2.e b/tests/char/char2.e new file mode 100644 index 0000000000000000000000000000000000000000..0b8dba527706d8838b716ac74fb50c1ffc83b6d2 --- /dev/null +++ b/tests/char/char2.e @@ -0,0 +1,5 @@ +int main(){ + char c = 'b'; + print_char(c+1); + return c; +} diff --git a/tests/char/char2.e.expect_14_12_3_8_12 b/tests/char/char2.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..d2905722d959ee2448860a8ccbedd0279f329c97 --- /dev/null +++ b/tests/char/char2.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "c", "error": null, "retval": 98} \ No newline at end of file diff --git a/tests/char/char2.e.expect_1_2_3 b/tests/char/char2.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..d2905722d959ee2448860a8ccbedd0279f329c97 --- /dev/null +++ b/tests/char/char2.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "c", "error": null, "retval": 98} \ No newline at end of file diff --git a/tests/char/char2.e.expect_lexer b/tests/char/char2.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..60571b62ac6b036714df5f7feba43a0e9f165445 --- /dev/null +++ b/tests/char/char2.e.expect_lexer @@ -0,0 +1,22 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_CHAR +SYM_IDENTIFIER(c) +SYM_ASSIGN +SYM_CHARACTER(b) +SYM_SEMICOLON +SYM_IDENTIFIER(print_char) +SYM_LPARENTHESIS +SYM_IDENTIFIER(c) +SYM_PLUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(c) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/char/char_fun.e b/tests/char/char_fun.e index fd90c93490833c574ac2ada08f4cdb69c6bb7ed2..a033bb7fbe6ddb5dd5177f2e779d201e87f81bc5 100644 --- a/tests/char/char_fun.e +++ b/tests/char/char_fun.e @@ -2,7 +2,7 @@ char f(char c){ return c + 1; } -int main(int argc, char** argv){ +int main(){ print_char(f('c')); return 0; } diff --git a/tests/char/char_fun.e.expect_14_12_3_8_12 b/tests/char/char_fun.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..f0c44f5d97843845f8f11b05376935584f544917 --- /dev/null +++ b/tests/char/char_fun.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "d", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/char/char_fun.e.expect_1_2_3 b/tests/char/char_fun.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..f0c44f5d97843845f8f11b05376935584f544917 --- /dev/null +++ b/tests/char/char_fun.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "d", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/char/char_fun.e.expect_lexer b/tests/char/char_fun.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..71a8f589c7e227826fe15e8bea3df84736137f3f --- /dev/null +++ b/tests/char/char_fun.e.expect_lexer @@ -0,0 +1,31 @@ +SYM_CHAR +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_CHAR +SYM_IDENTIFIER(c) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(c) +SYM_PLUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print_char) +SYM_LPARENTHESIS +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_CHARACTER(c) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/1_or_3a.e b/tests/type_basic/1_or_3a.e new file mode 100644 index 0000000000000000000000000000000000000000..d246ea7824b18d90dd7accf3d94ebebfd7c84eb3 --- /dev/null +++ b/tests/type_basic/1_or_3a.e @@ -0,0 +1,6 @@ +int main(int a){ + if(a > 12){ + a = 1; + } else { a = 3 * a; } + return a; +} diff --git a/tests/type_basic/1_or_3a.e.expect_14_12_3_8_12 b/tests/type_basic/1_or_3a.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/1_or_3a.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/1_or_3a.e.expect_1_2_3 b/tests/type_basic/1_or_3a.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/type_basic/1_or_3a.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 3} \ No newline at end of file diff --git a/tests/type_basic/1_or_3a.e.expect_lexer b/tests/type_basic/1_or_3a.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..b46c5846f577a7e1c8db1d853ec73e9cdff2652e --- /dev/null +++ b/tests/type_basic/1_or_3a.e.expect_lexer @@ -0,0 +1,33 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_GT +SYM_INTEGER(12) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_ASTERISK +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/1_or_4.e b/tests/type_basic/1_or_4.e new file mode 100644 index 0000000000000000000000000000000000000000..de75cc85d1d0455aac906ca713f5404cab594e18 --- /dev/null +++ b/tests/type_basic/1_or_4.e @@ -0,0 +1,17 @@ +int main(int a){ + int x; + if(a < 12){ + if(a < 23){ + x = 1; + } else { + x = 3; + } + } else { + if (a < 12){ + x = 2; + } else { + x = 4; + } + } + return x; +} diff --git a/tests/type_basic/1_or_4.e.expect_14_12_3_8_12 b/tests/type_basic/1_or_4.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..da50e81a3771635762245edfab77e00ab52b5332 --- /dev/null +++ b/tests/type_basic/1_or_4.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 4} \ No newline at end of file diff --git a/tests/type_basic/1_or_4.e.expect_1_2_3 b/tests/type_basic/1_or_4.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/1_or_4.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/1_or_4.e.expect_lexer b/tests/type_basic/1_or_4.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..aee5846525a74030f33c2c56c1d3be004bd7dd10 --- /dev/null +++ b/tests/type_basic/1_or_4.e.expect_lexer @@ -0,0 +1,64 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_LT +SYM_INTEGER(12) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_LT +SYM_INTEGER(23) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_LT +SYM_INTEGER(12) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(4) +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/2xpy.e b/tests/type_basic/2xpy.e new file mode 100644 index 0000000000000000000000000000000000000000..f458d829bdd8b4bef9bc8d6c0fa575034f4c2f21 --- /dev/null +++ b/tests/type_basic/2xpy.e @@ -0,0 +1,3 @@ +int main(int x, int y){ + return 2 * x + y; +} diff --git a/tests/type_basic/2xpy.e.expect_14_12_3_8_12 b/tests/type_basic/2xpy.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1cd05b5f658b129703da224fe44fb509455cab2f --- /dev/null +++ b/tests/type_basic/2xpy.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 40} \ No newline at end of file diff --git a/tests/type_basic/2xpy.e.expect_1_2_3 b/tests/type_basic/2xpy.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..da50e81a3771635762245edfab77e00ab52b5332 --- /dev/null +++ b/tests/type_basic/2xpy.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 4} \ No newline at end of file diff --git a/tests/type_basic/2xpy.e.expect_lexer b/tests/type_basic/2xpy.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..25d17134ac9ee8b389f959be248e301d98b4f0f2 --- /dev/null +++ b/tests/type_basic/2xpy.e.expect_lexer @@ -0,0 +1,19 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(2) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/35gt12.e b/tests/type_basic/35gt12.e new file mode 100644 index 0000000000000000000000000000000000000000..bcf5a3496f8bb46197bf99ee25179736bf96ba26 --- /dev/null +++ b/tests/type_basic/35gt12.e @@ -0,0 +1,7 @@ +int main(){ + int a = 5 * 7; + if(a > 12){ + a = 1; + } else { a = 3 * a; } + return a; +} diff --git a/tests/type_basic/35gt12.e.expect_14_12_3_8_12 b/tests/type_basic/35gt12.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/35gt12.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/35gt12.e.expect_1_2_3 b/tests/type_basic/35gt12.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/35gt12.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/35gt12.e.expect_lexer b/tests/type_basic/35gt12.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..acf44608757d2148d114610ab6a6dd56f8655706 --- /dev/null +++ b/tests/type_basic/35gt12.e.expect_lexer @@ -0,0 +1,38 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_ASTERISK +SYM_INTEGER(7) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_GT +SYM_INTEGER(12) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_ASTERISK +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/a_19.e b/tests/type_basic/a_19.e new file mode 100644 index 0000000000000000000000000000000000000000..6b87138626cc8504050656e21f76f408e6a2c3bd --- /dev/null +++ b/tests/type_basic/a_19.e @@ -0,0 +1,4 @@ +int main(){ + int a = 3; + return (a*5)+4*(3-2); +} diff --git a/tests/type_basic/a_19.e.expect_14_12_3_8_12 b/tests/type_basic/a_19.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..41cdc3312527617536f3eb8dc095834bef47d4ef --- /dev/null +++ b/tests/type_basic/a_19.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 19} \ No newline at end of file diff --git a/tests/type_basic/a_19.e.expect_1_2_3 b/tests/type_basic/a_19.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..41cdc3312527617536f3eb8dc095834bef47d4ef --- /dev/null +++ b/tests/type_basic/a_19.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 19} \ No newline at end of file diff --git a/tests/type_basic/a_19.e.expect_lexer b/tests/type_basic/a_19.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..36458353b3063a9071534ee0ca0c2d0db7a9b38b --- /dev/null +++ b/tests/type_basic/a_19.e.expect_lexer @@ -0,0 +1,27 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RETURN +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_ASTERISK +SYM_INTEGER(5) +SYM_RPARENTHESIS +SYM_PLUS +SYM_INTEGER(4) +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_MINUS +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/a_simple_variable_23.e b/tests/type_basic/a_simple_variable_23.e new file mode 100644 index 0000000000000000000000000000000000000000..3c286ec0eebbc9aaf14e62d6c322b71d22d28a42 --- /dev/null +++ b/tests/type_basic/a_simple_variable_23.e @@ -0,0 +1,4 @@ +int main(){ + int a_simple_variable = 8; + return a_simple_variable + 5 * 3; +} diff --git a/tests/type_basic/a_simple_variable_23.e.expect_14_12_3_8_12 b/tests/type_basic/a_simple_variable_23.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..810d9ab964ab9318fda9fcf35cf83eb5cb49d546 --- /dev/null +++ b/tests/type_basic/a_simple_variable_23.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23} \ No newline at end of file diff --git a/tests/type_basic/a_simple_variable_23.e.expect_1_2_3 b/tests/type_basic/a_simple_variable_23.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..810d9ab964ab9318fda9fcf35cf83eb5cb49d546 --- /dev/null +++ b/tests/type_basic/a_simple_variable_23.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23} \ No newline at end of file diff --git a/tests/type_basic/a_simple_variable_23.e.expect_lexer b/tests/type_basic/a_simple_variable_23.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..4e1e267fb8a0657bd25f5584b0df2f819a2997e9 --- /dev/null +++ b/tests/type_basic/a_simple_variable_23.e.expect_lexer @@ -0,0 +1,19 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a_simple_variable) +SYM_ASSIGN +SYM_INTEGER(8) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(a_simple_variable) +SYM_PLUS +SYM_INTEGER(5) +SYM_ASTERISK +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/arg-test.e b/tests/type_basic/arg-test.e new file mode 100644 index 0000000000000000000000000000000000000000..84af816686b099bd04554140d10ad133c7045b90 --- /dev/null +++ b/tests/type_basic/arg-test.e @@ -0,0 +1,15 @@ +int main(int n, int m){ + int a = 10; + int b = 20; + int x; + if (3 > n){ + x = a; + } else { + x = b; + } + return x; +} +int f(int x){ + int n = 3; + return 3 * x; +} diff --git a/tests/type_basic/arg-test.e.expect_14_12_3_8_12 b/tests/type_basic/arg-test.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..4de51e4d38522a71a09ab4c411d09d99f1e80932 --- /dev/null +++ b/tests/type_basic/arg-test.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 20} \ No newline at end of file diff --git a/tests/type_basic/arg-test.e.expect_1_2_3 b/tests/type_basic/arg-test.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..b55e8e280c5e45c2be40c1a6b56defcd278107ea --- /dev/null +++ b/tests/type_basic/arg-test.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 10} \ No newline at end of file diff --git a/tests/type_basic/arg-test.e.expect_lexer b/tests/type_basic/arg-test.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..04fa61be5adca8cf1f060cc15a16bb4ca3987a18 --- /dev/null +++ b/tests/type_basic/arg-test.e.expect_lexer @@ -0,0 +1,65 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(m) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_INTEGER(20) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_GT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(3) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/comment++.e b/tests/type_basic/comment++.e new file mode 100644 index 0000000000000000000000000000000000000000..c811dfb3b0168f53a17689f7cd109803131ecf58 --- /dev/null +++ b/tests/type_basic/comment++.e @@ -0,0 +1,5 @@ +/** /**/ +/** Commentaire ! */ +int main(){ + return 23; +} diff --git a/tests/type_basic/comment++.e.expect_14_12_3_8_12 b/tests/type_basic/comment++.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..810d9ab964ab9318fda9fcf35cf83eb5cb49d546 --- /dev/null +++ b/tests/type_basic/comment++.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23} \ No newline at end of file diff --git a/tests/type_basic/comment++.e.expect_1_2_3 b/tests/type_basic/comment++.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..810d9ab964ab9318fda9fcf35cf83eb5cb49d546 --- /dev/null +++ b/tests/type_basic/comment++.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 23} \ No newline at end of file diff --git a/tests/type_basic/comment++.e.expect_lexer b/tests/type_basic/comment++.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..da07d6ce028e1997a5c69db45fea29b9395f1b38 --- /dev/null +++ b/tests/type_basic/comment++.e.expect_lexer @@ -0,0 +1,10 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(23) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/comment.e b/tests/type_basic/comment.e new file mode 100644 index 0000000000000000000000000000000000000000..d89e897435cf7f6b90daf574125c172af35d7ca7 --- /dev/null +++ b/tests/type_basic/comment.e @@ -0,0 +1,6 @@ +// Hello, this is a comment +int main(int a){ +/* a multi-line +comment*/ +return a / 2; +} diff --git a/tests/type_basic/comment.e.expect_14_12_3_8_12 b/tests/type_basic/comment.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..fde1f638d743ba12ee106e88aa76743c84363167 --- /dev/null +++ b/tests/type_basic/comment.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 7} \ No newline at end of file diff --git a/tests/type_basic/comment.e.expect_1_2_3 b/tests/type_basic/comment.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/comment.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/comment.e.expect_lexer b/tests/type_basic/comment.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..9996cf64841380b219736b95683a44f94d5f4115 --- /dev/null +++ b/tests/type_basic/comment.e.expect_lexer @@ -0,0 +1,14 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_DIV +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/dec_to_0.e b/tests/type_basic/dec_to_0.e new file mode 100644 index 0000000000000000000000000000000000000000..0b5887577c93c5cad9a3dc11df2cf16a836abc4f --- /dev/null +++ b/tests/type_basic/dec_to_0.e @@ -0,0 +1,6 @@ +int main(int n){ + while(n > 0){ + n = n - 1; + } + return n; +} diff --git a/tests/type_basic/dec_to_0.e.expect_14_12_3_8_12 b/tests/type_basic/dec_to_0.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/dec_to_0.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/dec_to_0.e.expect_1_2_3 b/tests/type_basic/dec_to_0.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/dec_to_0.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/dec_to_0.e.expect_lexer b/tests/type_basic/dec_to_0.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..88da258020055f86891f9f13d539290556a23ae4 --- /dev/null +++ b/tests/type_basic/dec_to_0.e.expect_lexer @@ -0,0 +1,26 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/double.e b/tests/type_basic/double.e new file mode 100644 index 0000000000000000000000000000000000000000..9cec46b83a32f0d05821ada875ddfa8cb9341274 --- /dev/null +++ b/tests/type_basic/double.e @@ -0,0 +1,4 @@ +int main(int n){ + n = n * 2; + return n; +} diff --git a/tests/type_basic/double.e.expect_14_12_3_8_12 b/tests/type_basic/double.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..e9f03bd9e74c0ac09410036fe9b382b569b3aeb0 --- /dev/null +++ b/tests/type_basic/double.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 28} \ No newline at end of file diff --git a/tests/type_basic/double.e.expect_1_2_3 b/tests/type_basic/double.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..df1c5a5ba4e1647c7e3409ee9539a3583afa9bdf --- /dev/null +++ b/tests/type_basic/double.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 2} \ No newline at end of file diff --git a/tests/type_basic/double.e.expect_lexer b/tests/type_basic/double.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..a237aec21712c83efa0c6f0db7044045e25c08e1 --- /dev/null +++ b/tests/type_basic/double.e.expect_lexer @@ -0,0 +1,18 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_ASTERISK +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/fac.e b/tests/type_basic/fac.e new file mode 100644 index 0000000000000000000000000000000000000000..2b1761eb2bdeaba6b3f42c88aaa4b932bf6653e1 --- /dev/null +++ b/tests/type_basic/fac.e @@ -0,0 +1,12 @@ +int main(int n){ + if(n < 0) { n = 0; } + else { } + + int res = 1; + while(n > 0){ + res = n * res; + n = n - 1; + } + + return res; +} diff --git a/tests/type_basic/fac.e.expect_14_12_3_8_12 b/tests/type_basic/fac.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..fa26d1e83fb28859094630973eb4f1a6280efb04 --- /dev/null +++ b/tests/type_basic/fac.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 87178291200} \ No newline at end of file diff --git a/tests/type_basic/fac.e.expect_1_2_3 b/tests/type_basic/fac.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/fac.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/fac.e.expect_lexer b/tests/type_basic/fac.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..03f393a47bc20f7677720c624cacff6274d2f74a --- /dev/null +++ b/tests/type_basic/fac.e.expect_lexer @@ -0,0 +1,52 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_LT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_ASTERISK +SYM_IDENTIFIER(res) +SYM_SEMICOLON +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(res) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/fibbetter.e b/tests/type_basic/fibbetter.e new file mode 100644 index 0000000000000000000000000000000000000000..b66019c402461f77d1cc118695d58ee830a6947a --- /dev/null +++ b/tests/type_basic/fibbetter.e @@ -0,0 +1,12 @@ +int main(int n){ + int i = 0; // t6 + int j = 1; // t5 + int k = 0; // t4 + while(k < n){ + int tmp = i + j; + i = j; + j = tmp; + k = k + 1; + } + return i; +} diff --git a/tests/type_basic/fibbetter.e.expect_14_12_3_8_12 b/tests/type_basic/fibbetter.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1fef2374b55b0d9496617cec0a857a07906f799f --- /dev/null +++ b/tests/type_basic/fibbetter.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/type_basic/fibbetter.e.expect_1_2_3 b/tests/type_basic/fibbetter.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/fibbetter.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/fibbetter.e.expect_lexer b/tests/type_basic/fibbetter.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..d3a339b017a7571e2941cff48560c6fa4999dd95 --- /dev/null +++ b/tests/type_basic/fibbetter.e.expect_lexer @@ -0,0 +1,56 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(j) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(k) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(k) +SYM_LT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(tmp) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_PLUS +SYM_IDENTIFIER(j) +SYM_SEMICOLON +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(j) +SYM_SEMICOLON +SYM_IDENTIFIER(j) +SYM_ASSIGN +SYM_IDENTIFIER(tmp) +SYM_SEMICOLON +SYM_IDENTIFIER(k) +SYM_ASSIGN +SYM_IDENTIFIER(k) +SYM_PLUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(i) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/gcd.e b/tests/type_basic/gcd.e new file mode 100644 index 0000000000000000000000000000000000000000..10c5b2ba50117bba9b7ea097acbd861f4534b348 --- /dev/null +++ b/tests/type_basic/gcd.e @@ -0,0 +1,9 @@ +int main(int a, int b){ + int t; + while(b != 0){ + t = b; + b = a % b; + a = t; + } + return a; +} diff --git a/tests/type_basic/gcd.e.expect_14_12_3_8_12 b/tests/type_basic/gcd.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..df1c5a5ba4e1647c7e3409ee9539a3583afa9bdf --- /dev/null +++ b/tests/type_basic/gcd.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/type_basic/gcd.e.expect_1_2_3 b/tests/type_basic/gcd.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/gcd.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/gcd.e.expect_lexer b/tests/type_basic/gcd.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..202f2a30e64f5a4df75191dbae85d3d36097aeda --- /dev/null +++ b/tests/type_basic/gcd.e.expect_lexer @@ -0,0 +1,40 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(t) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(b) +SYM_NOTEQ +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(t) +SYM_ASSIGN +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_MOD +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_IDENTIFIER(t) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/just_a_variable_37.e b/tests/type_basic/just_a_variable_37.e new file mode 100644 index 0000000000000000000000000000000000000000..c7efc4fbe80e5db00893fb9f6ebe9a67a5565551 --- /dev/null +++ b/tests/type_basic/just_a_variable_37.e @@ -0,0 +1,4 @@ +int main(){ + int just_a_variable = 37; + return just_a_variable; +} diff --git a/tests/type_basic/just_a_variable_37.e.expect_14_12_3_8_12 b/tests/type_basic/just_a_variable_37.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..016d6cd30c8fc3fd3f0ef57bfe183aa6023661fa --- /dev/null +++ b/tests/type_basic/just_a_variable_37.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 37} \ No newline at end of file diff --git a/tests/type_basic/just_a_variable_37.e.expect_1_2_3 b/tests/type_basic/just_a_variable_37.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..016d6cd30c8fc3fd3f0ef57bfe183aa6023661fa --- /dev/null +++ b/tests/type_basic/just_a_variable_37.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 37} \ No newline at end of file diff --git a/tests/type_basic/just_a_variable_37.e.expect_lexer b/tests/type_basic/just_a_variable_37.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..d50f0b7c6060de6d60becb1bce657dafe3a06044 --- /dev/null +++ b/tests/type_basic/just_a_variable_37.e.expect_lexer @@ -0,0 +1,15 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(just_a_variable) +SYM_ASSIGN +SYM_INTEGER(37) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(just_a_variable) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/lexerror.e b/tests/type_basic/lexerror.e new file mode 100644 index 0000000000000000000000000000000000000000..dd56369989be5a3cafb3405f8056f6d6c3df2e37 --- /dev/null +++ b/tests/type_basic/lexerror.e @@ -0,0 +1 @@ +&$ diff --git a/tests/type_basic/loop.e b/tests/type_basic/loop.e new file mode 100644 index 0000000000000000000000000000000000000000..556b0045d0f87480c3e81c70afaa66f841518691 --- /dev/null +++ b/tests/type_basic/loop.e @@ -0,0 +1,15 @@ +int main(){ + int i = 10; + int a = 2; + int res = 0; + while(i > 0){ + int x = a + a; + if(a > 4){ + res = res + x; + } else { + res = res - x; + } + i = i - 1; + } + return res; +} diff --git a/tests/type_basic/loop.e.expect_14_12_3_8_12 b/tests/type_basic/loop.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..919b014322ed6e46ea283467b56f755be461e3c5 --- /dev/null +++ b/tests/type_basic/loop.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": -40} \ No newline at end of file diff --git a/tests/type_basic/loop.e.expect_1_2_3 b/tests/type_basic/loop.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..919b014322ed6e46ea283467b56f755be461e3c5 --- /dev/null +++ b/tests/type_basic/loop.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": -40} \ No newline at end of file diff --git a/tests/type_basic/loop.e.expect_lexer b/tests/type_basic/loop.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..01dbf81dcf082195313b130335cf95fb744f0fd1 --- /dev/null +++ b/tests/type_basic/loop.e.expect_lexer @@ -0,0 +1,69 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_GT +SYM_INTEGER(4) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(res) +SYM_PLUS +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(res) +SYM_MINUS +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(res) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/loop2.e b/tests/type_basic/loop2.e new file mode 100644 index 0000000000000000000000000000000000000000..0f452a33d374d6a1454b38e73fc401681904662d --- /dev/null +++ b/tests/type_basic/loop2.e @@ -0,0 +1,13 @@ +int main(){ + int i = 20; + int a; + while(i > 0){ + if(i < 5){ + a = 5; + } else { + a = 6; + } + i = i - 1; + } + return i; +} diff --git a/tests/type_basic/loop2.e.expect_14_12_3_8_12 b/tests/type_basic/loop2.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/loop2.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/loop2.e.expect_1_2_3 b/tests/type_basic/loop2.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/loop2.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/loop2.e.expect_lexer b/tests/type_basic/loop2.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..7bf5b4022603e05afc0f3beb46ea366266b05530 --- /dev/null +++ b/tests/type_basic/loop2.e.expect_lexer @@ -0,0 +1,51 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(20) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_LT +SYM_INTEGER(5) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(6) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(i) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/loop3.e b/tests/type_basic/loop3.e new file mode 100644 index 0000000000000000000000000000000000000000..25756bb0d45e762968077901fd06e5855dd034c7 --- /dev/null +++ b/tests/type_basic/loop3.e @@ -0,0 +1,14 @@ +int main(){ + int i = 20; + int c = 8; + int a = 5; + int b = 0; + while(i > 0){ + if(i < 5){ + a = 4 + c; + } + b = b + a; + i = i - 1; + } + return b; +} diff --git a/tests/type_basic/loop3.e.expect_14_12_3_8_12 b/tests/type_basic/loop3.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..feb4775c473e7c8f42a997c5dc5a04ce52c73eaa --- /dev/null +++ b/tests/type_basic/loop3.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 128} \ No newline at end of file diff --git a/tests/type_basic/loop3.e.expect_1_2_3 b/tests/type_basic/loop3.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..feb4775c473e7c8f42a997c5dc5a04ce52c73eaa --- /dev/null +++ b/tests/type_basic/loop3.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 128} \ No newline at end of file diff --git a/tests/type_basic/loop3.e.expect_lexer b/tests/type_basic/loop3.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..4be870b60f4cf75881d86ef26285b6e2936c98c9 --- /dev/null +++ b/tests/type_basic/loop3.e.expect_lexer @@ -0,0 +1,64 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(20) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(c) +SYM_ASSIGN +SYM_INTEGER(8) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_LT +SYM_INTEGER(5) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(4) +SYM_PLUS +SYM_IDENTIFIER(c) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_IDENTIFIER(b) +SYM_PLUS +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/loop4.e b/tests/type_basic/loop4.e new file mode 100644 index 0000000000000000000000000000000000000000..bcfb12e4a43b1746284a3cebad80d035a52a9dc0 --- /dev/null +++ b/tests/type_basic/loop4.e @@ -0,0 +1,20 @@ +int main(){ + int i = 10; + int a = 2; + int res = 0; + while(i > 0){ + int x = a + a; + int y = 1 + x; + if(i > 4){ + res = res + x; + } else { + if (i < 2){ + res = res - y; + } else { + res = res + x - y; + } + } + i = i - 1; + } + return res; +} diff --git a/tests/type_basic/loop4.e.expect_14_12_3_8_12 b/tests/type_basic/loop4.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..4c5f6717cdc873d39fe41829359cd3390a60c009 --- /dev/null +++ b/tests/type_basic/loop4.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 16} \ No newline at end of file diff --git a/tests/type_basic/loop4.e.expect_1_2_3 b/tests/type_basic/loop4.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..4c5f6717cdc873d39fe41829359cd3390a60c009 --- /dev/null +++ b/tests/type_basic/loop4.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 16} \ No newline at end of file diff --git a/tests/type_basic/loop4.e.expect_lexer b/tests/type_basic/loop4.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..d11120d1cf973ee4062cd2c29110c5cd77954fe4 --- /dev/null +++ b/tests/type_basic/loop4.e.expect_lexer @@ -0,0 +1,95 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_PLUS +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_GT +SYM_INTEGER(4) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(res) +SYM_PLUS +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_LT +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(res) +SYM_MINUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(res) +SYM_ASSIGN +SYM_IDENTIFIER(res) +SYM_PLUS +SYM_IDENTIFIER(x) +SYM_MINUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(res) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/lots-of-regs.e b/tests/type_basic/lots-of-regs.e new file mode 100644 index 0000000000000000000000000000000000000000..5180cb59557a105019294d7983a9ab39a867b7c4 --- /dev/null +++ b/tests/type_basic/lots-of-regs.e @@ -0,0 +1,21 @@ +int main(int a, int b){ + int x = a; + int y = b; + int z = a * b; + int t = a + b + z; + int u = z - 3; + int v = x - u; + int w = a * x + z - t; + int i = 35; + int j = i * w; + int k = 8 * t + z / i; + int l = 19 * k; + int m = 12; + int n = 12; + int o = 12; + int p = 12; + int q = 12; + int r = 12; + int s = 12; + return x + y + z + t + u + v + w + i + j + k + l + m + n + o + p + q + r + s; +} diff --git a/tests/type_basic/lots-of-regs.e.expect_14_12_3_8_12 b/tests/type_basic/lots-of-regs.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..36bc30ad8e3a677ef8d97fda646b7d615463399b --- /dev/null +++ b/tests/type_basic/lots-of-regs.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 37761} \ No newline at end of file diff --git a/tests/type_basic/lots-of-regs.e.expect_1_2_3 b/tests/type_basic/lots-of-regs.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..0f7c0dd6058a095a430101f739d92a8259ed714c --- /dev/null +++ b/tests/type_basic/lots-of-regs.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 858} \ No newline at end of file diff --git a/tests/type_basic/lots-of-regs.e.expect_lexer b/tests/type_basic/lots-of-regs.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..da9931e65584ce27bb70ec0dc09530dc2fd82622 --- /dev/null +++ b/tests/type_basic/lots-of-regs.e.expect_lexer @@ -0,0 +1,165 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(b) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_ASTERISK +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(t) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_IDENTIFIER(b) +SYM_PLUS +SYM_IDENTIFIER(z) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(u) +SYM_ASSIGN +SYM_IDENTIFIER(z) +SYM_MINUS +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(v) +SYM_ASSIGN +SYM_IDENTIFIER(x) +SYM_MINUS +SYM_IDENTIFIER(u) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(w) +SYM_ASSIGN +SYM_IDENTIFIER(a) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(z) +SYM_MINUS +SYM_IDENTIFIER(t) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(35) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(j) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_ASTERISK +SYM_IDENTIFIER(w) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(k) +SYM_ASSIGN +SYM_INTEGER(8) +SYM_ASTERISK +SYM_IDENTIFIER(t) +SYM_PLUS +SYM_IDENTIFIER(z) +SYM_DIV +SYM_IDENTIFIER(i) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(l) +SYM_ASSIGN +SYM_INTEGER(19) +SYM_ASTERISK +SYM_IDENTIFIER(k) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(m) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(o) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(p) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(q) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(r) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(s) +SYM_ASSIGN +SYM_INTEGER(12) +SYM_SEMICOLON +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_PLUS +SYM_IDENTIFIER(v) +SYM_PLUS +SYM_IDENTIFIER(w) +SYM_PLUS +SYM_IDENTIFIER(i) +SYM_PLUS +SYM_IDENTIFIER(j) +SYM_PLUS +SYM_IDENTIFIER(k) +SYM_PLUS +SYM_IDENTIFIER(l) +SYM_PLUS +SYM_IDENTIFIER(m) +SYM_PLUS +SYM_IDENTIFIER(n) +SYM_PLUS +SYM_IDENTIFIER(o) +SYM_PLUS +SYM_IDENTIFIER(p) +SYM_PLUS +SYM_IDENTIFIER(q) +SYM_PLUS +SYM_IDENTIFIER(r) +SYM_PLUS +SYM_IDENTIFIER(s) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/muldivmod.e b/tests/type_basic/muldivmod.e new file mode 100644 index 0000000000000000000000000000000000000000..ae50329cbd7a5cf5abc2a03b006c8ea43259b389 --- /dev/null +++ b/tests/type_basic/muldivmod.e @@ -0,0 +1,5 @@ +int main(){ + int i = 823333; + int j = 7392; + return (i*j/7) % 10; +} diff --git a/tests/type_basic/muldivmod.e.expect_14_12_3_8_12 b/tests/type_basic/muldivmod.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..61b83a85dd0aeeb0ff59aaeb795875114625cdf7 --- /dev/null +++ b/tests/type_basic/muldivmod.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 8} \ No newline at end of file diff --git a/tests/type_basic/muldivmod.e.expect_1_2_3 b/tests/type_basic/muldivmod.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..61b83a85dd0aeeb0ff59aaeb795875114625cdf7 --- /dev/null +++ b/tests/type_basic/muldivmod.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 8} \ No newline at end of file diff --git a/tests/type_basic/muldivmod.e.expect_lexer b/tests/type_basic/muldivmod.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..59eca122e6aeffbf33b9995b6f97e20495ba3677 --- /dev/null +++ b/tests/type_basic/muldivmod.e.expect_lexer @@ -0,0 +1,28 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(823333) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(j) +SYM_ASSIGN +SYM_INTEGER(7392) +SYM_SEMICOLON +SYM_RETURN +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_ASTERISK +SYM_IDENTIFIER(j) +SYM_DIV +SYM_INTEGER(7) +SYM_RPARENTHESIS +SYM_MOD +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/mulmulmul.e b/tests/type_basic/mulmulmul.e new file mode 100644 index 0000000000000000000000000000000000000000..35404b0886f5229ae587aaea8c176afb97e4bebc --- /dev/null +++ b/tests/type_basic/mulmulmul.e @@ -0,0 +1,3 @@ +int main(){ + return 1 * (2 * (3 * 4 * (5 * 6) * 7)); +} diff --git a/tests/type_basic/mulmulmul.e.expect_14_12_3_8_12 b/tests/type_basic/mulmulmul.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..6bca38098d934670e1e51e5369182a2a6ec01cee --- /dev/null +++ b/tests/type_basic/mulmulmul.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 5040} \ No newline at end of file diff --git a/tests/type_basic/mulmulmul.e.expect_1_2_3 b/tests/type_basic/mulmulmul.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..6bca38098d934670e1e51e5369182a2a6ec01cee --- /dev/null +++ b/tests/type_basic/mulmulmul.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 5040} \ No newline at end of file diff --git a/tests/type_basic/mulmulmul.e.expect_lexer b/tests/type_basic/mulmulmul.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..6be78df6756bdc7aea9246114de6a552fc045082 --- /dev/null +++ b/tests/type_basic/mulmulmul.e.expect_lexer @@ -0,0 +1,28 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(1) +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_INTEGER(2) +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_ASTERISK +SYM_INTEGER(4) +SYM_ASTERISK +SYM_LPARENTHESIS +SYM_INTEGER(5) +SYM_ASTERISK +SYM_INTEGER(6) +SYM_RPARENTHESIS +SYM_ASTERISK +SYM_INTEGER(7) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/prime.e b/tests/type_basic/prime.e new file mode 100644 index 0000000000000000000000000000000000000000..03bb55fee3b31c6d0bf06c5301c4c9ca23b7d5d6 --- /dev/null +++ b/tests/type_basic/prime.e @@ -0,0 +1,20 @@ +int main(int n){ + print(n); + while(n%2 == 0){ + print(2); + n = n / 2; + } + int f = 3; + while ( f * f <= n ){ + if ( n % f == 0 ) { + print(f); + n = n / f; + } else { + f = f + 2; + } + } + if ( n != 1 ) { + print(n); + } + return 0; +} diff --git a/tests/type_basic/prime.e.expect_14_12_3_8_12 b/tests/type_basic/prime.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..372d54057e19aff0c25c2287e77ed03cfed94b98 --- /dev/null +++ b/tests/type_basic/prime.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "14\n2\n7\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/prime.e.expect_1_2_3 b/tests/type_basic/prime.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..eb1504dc83ea5564e4adb5e00344555cd86cc389 --- /dev/null +++ b/tests/type_basic/prime.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "1\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/prime.e.expect_lexer b/tests/type_basic/prime.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..8308731347edbe05d9c5b046c1ff5051a794e1c4 --- /dev/null +++ b/tests/type_basic/prime.e.expect_lexer @@ -0,0 +1,96 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MOD +SYM_INTEGER(2) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_INTEGER(2) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_DIV +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(f) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(f) +SYM_ASTERISK +SYM_IDENTIFIER(f) +SYM_LEQ +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MOD +SYM_IDENTIFIER(f) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(f) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_DIV +SYM_IDENTIFIER(f) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(f) +SYM_ASSIGN +SYM_IDENTIFIER(f) +SYM_PLUS +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_NOTEQ +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/print_int.e b/tests/type_basic/print_int.e new file mode 100644 index 0000000000000000000000000000000000000000..5f1554b844a821b594bac26d833fbb1b3c770a7c --- /dev/null +++ b/tests/type_basic/print_int.e @@ -0,0 +1,4 @@ +int main(){ + print(300); + return 0; + } diff --git a/tests/type_basic/print_int.e.expect_14_12_3_8_12 b/tests/type_basic/print_int.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..5867cb8e972a0f91df6cca403a804ced2b94c8f2 --- /dev/null +++ b/tests/type_basic/print_int.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "300\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/print_int.e.expect_1_2_3 b/tests/type_basic/print_int.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..5867cb8e972a0f91df6cca403a804ced2b94c8f2 --- /dev/null +++ b/tests/type_basic/print_int.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "300\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/print_int.e.expect_lexer b/tests/type_basic/print_int.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..07ba560c9b84beea2675c930df520aab59aa50b2 --- /dev/null +++ b/tests/type_basic/print_int.e.expect_lexer @@ -0,0 +1,15 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_INTEGER(300) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/range_0_10.e b/tests/type_basic/range_0_10.e new file mode 100644 index 0000000000000000000000000000000000000000..1f05dd11423ed65c681da3364447bae18f0f6dc5 --- /dev/null +++ b/tests/type_basic/range_0_10.e @@ -0,0 +1,8 @@ +int main(int n){ + if(n > 10) { n = 10; } + else { + if ( n < 0 ) { n = 0; } + else { } + } + return n; +} diff --git a/tests/type_basic/range_0_10.e.expect_14_12_3_8_12 b/tests/type_basic/range_0_10.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..b55e8e280c5e45c2be40c1a6b56defcd278107ea --- /dev/null +++ b/tests/type_basic/range_0_10.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 10} \ No newline at end of file diff --git a/tests/type_basic/range_0_10.e.expect_1_2_3 b/tests/type_basic/range_0_10.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/range_0_10.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/range_0_10.e.expect_lexer b/tests/type_basic/range_0_10.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..1781dd90f70d777e5fd77f15d97a8c095b96da54 --- /dev/null +++ b/tests/type_basic/range_0_10.e.expect_lexer @@ -0,0 +1,42 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(10) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_LT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RBRACE +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/range_10_0_then_dec0.e b/tests/type_basic/range_10_0_then_dec0.e new file mode 100644 index 0000000000000000000000000000000000000000..5c1dba61e3e3b0b7b85b328b7f37cb84697c6f94 --- /dev/null +++ b/tests/type_basic/range_10_0_then_dec0.e @@ -0,0 +1,11 @@ +int main(int n){ + if(n > 10) { n = 10; } + else { + if ( n < 0 ) { n = 0; } + else { } + } + while( n > 0){ + n=n-1; + } + return n; +} diff --git a/tests/type_basic/range_10_0_then_dec0.e.expect_14_12_3_8_12 b/tests/type_basic/range_10_0_then_dec0.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/range_10_0_then_dec0.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/range_10_0_then_dec0.e.expect_1_2_3 b/tests/type_basic/range_10_0_then_dec0.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/range_10_0_then_dec0.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/range_10_0_then_dec0.e.expect_lexer b/tests/type_basic/range_10_0_then_dec0.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..43125c4ed8cf1afece4ec74b189cf3684162a7ba --- /dev/null +++ b/tests/type_basic/range_10_0_then_dec0.e.expect_lexer @@ -0,0 +1,56 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(10) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(10) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_LT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RBRACE +SYM_RBRACE +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/ret0.e b/tests/type_basic/ret0.e new file mode 100644 index 0000000000000000000000000000000000000000..1d20be45d6ab1a490aea9a217f38e6392357ea6e --- /dev/null +++ b/tests/type_basic/ret0.e @@ -0,0 +1,3 @@ +int main(){ +return 0; +} diff --git a/tests/type_basic/ret0.e.expect_14_12_3_8_12 b/tests/type_basic/ret0.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/ret0.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/ret0.e.expect_1_2_3 b/tests/type_basic/ret0.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..42f3b7be56a5a32dc517bc2d95cd06ba49b8acae --- /dev/null +++ b/tests/type_basic/ret0.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_basic/ret0.e.expect_lexer b/tests/type_basic/ret0.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..60561b3ded9606e64c2bfc4a6492a3c0c3884e5c --- /dev/null +++ b/tests/type_basic/ret0.e.expect_lexer @@ -0,0 +1,10 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/ret20.e b/tests/type_basic/ret20.e new file mode 100644 index 0000000000000000000000000000000000000000..ae36a900463e6c80e24e5265c650ec94f7d2e5f2 --- /dev/null +++ b/tests/type_basic/ret20.e @@ -0,0 +1,6 @@ +int main(){ + int x = 5; + int y = x * 2; + x = 6 * x; + return x - y; +} diff --git a/tests/type_basic/ret20.e.expect_14_12_3_8_12 b/tests/type_basic/ret20.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..4de51e4d38522a71a09ab4c411d09d99f1e80932 --- /dev/null +++ b/tests/type_basic/ret20.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 20} \ No newline at end of file diff --git a/tests/type_basic/ret20.e.expect_1_2_3 b/tests/type_basic/ret20.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..4de51e4d38522a71a09ab4c411d09d99f1e80932 --- /dev/null +++ b/tests/type_basic/ret20.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 20} \ No newline at end of file diff --git a/tests/type_basic/ret20.e.expect_lexer b/tests/type_basic/ret20.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..d659c80b8cae70054cf88a7329e978a594ccec3c --- /dev/null +++ b/tests/type_basic/ret20.e.expect_lexer @@ -0,0 +1,30 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_IDENTIFIER(x) +SYM_ASTERISK +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(6) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_MINUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/ret21.e b/tests/type_basic/ret21.e new file mode 100644 index 0000000000000000000000000000000000000000..f10a3264bdeb02a72c08b7042fc492a528bb18bb --- /dev/null +++ b/tests/type_basic/ret21.e @@ -0,0 +1,7 @@ +int main(){ + int a = 7; + if(a > 12){ + a = 1; + } else { a = 3 * a; } + return a; +} diff --git a/tests/type_basic/ret21.e.expect_14_12_3_8_12 b/tests/type_basic/ret21.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..43b8874c2b664dea974bd32fb988a477dd4e8308 --- /dev/null +++ b/tests/type_basic/ret21.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 21} \ No newline at end of file diff --git a/tests/type_basic/ret21.e.expect_1_2_3 b/tests/type_basic/ret21.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..43b8874c2b664dea974bd32fb988a477dd4e8308 --- /dev/null +++ b/tests/type_basic/ret21.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 21} \ No newline at end of file diff --git a/tests/type_basic/ret21.e.expect_lexer b/tests/type_basic/ret21.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..aeca8d576c554afbdcf805e10d2f96614c80fcb1 --- /dev/null +++ b/tests/type_basic/ret21.e.expect_lexer @@ -0,0 +1,36 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(7) +SYM_SEMICOLON +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(a) +SYM_GT +SYM_INTEGER(12) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_IDENTIFIER(a) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_ASTERISK +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/ret60.e b/tests/type_basic/ret60.e new file mode 100644 index 0000000000000000000000000000000000000000..260814487ee7bb3f5ac64158dacd8d06423dfc54 --- /dev/null +++ b/tests/type_basic/ret60.e @@ -0,0 +1,5 @@ +int main(){ + int x = 3 + 7; + int y = 5 * x; + return x + y; +} diff --git a/tests/type_basic/ret60.e.expect_14_12_3_8_12 b/tests/type_basic/ret60.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..51f9f22bf4016f307a497d3cff177f01769872d5 --- /dev/null +++ b/tests/type_basic/ret60.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 60} \ No newline at end of file diff --git a/tests/type_basic/ret60.e.expect_1_2_3 b/tests/type_basic/ret60.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..51f9f22bf4016f307a497d3cff177f01769872d5 --- /dev/null +++ b/tests/type_basic/ret60.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 60} \ No newline at end of file diff --git a/tests/type_basic/ret60.e.expect_lexer b/tests/type_basic/ret60.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..014cbc89dca3bdfb6cf2d3c10cd93989258f7883 --- /dev/null +++ b/tests/type_basic/ret60.e.expect_lexer @@ -0,0 +1,26 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_PLUS +SYM_INTEGER(7) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/sum_ints_upto_10.e b/tests/type_basic/sum_ints_upto_10.e new file mode 100644 index 0000000000000000000000000000000000000000..80f976013dac52a83db0a3163e2cd422cae5a6c2 --- /dev/null +++ b/tests/type_basic/sum_ints_upto_10.e @@ -0,0 +1,13 @@ +int main(){ + int i = 0; + int x; + while(i < 10){ + if(i == 0){ + x = 1; + } + x = x + i; + i = i + 1; + } + return x; +} + diff --git a/tests/type_basic/sum_ints_upto_10.e.expect_14_12_3_8_12 b/tests/type_basic/sum_ints_upto_10.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..3bb7e49dac8aa0cbc843b6de7e45524882031ee8 --- /dev/null +++ b/tests/type_basic/sum_ints_upto_10.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 46} \ No newline at end of file diff --git a/tests/type_basic/sum_ints_upto_10.e.expect_1_2_3 b/tests/type_basic/sum_ints_upto_10.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..3bb7e49dac8aa0cbc843b6de7e45524882031ee8 --- /dev/null +++ b/tests/type_basic/sum_ints_upto_10.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 46} \ No newline at end of file diff --git a/tests/type_basic/sum_ints_upto_10.e.expect_lexer b/tests/type_basic/sum_ints_upto_10.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..d2420ab9814e532beebe7502cfb8f94591c5be6a --- /dev/null +++ b/tests/type_basic/sum_ints_upto_10.e.expect_lexer @@ -0,0 +1,50 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_LT +SYM_INTEGER(10) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(i) +SYM_SEMICOLON +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_PLUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/sum_ints_upto_n.e b/tests/type_basic/sum_ints_upto_n.e new file mode 100644 index 0000000000000000000000000000000000000000..dd9da5f5099da12b2baf1d2270575f5d20c54873 --- /dev/null +++ b/tests/type_basic/sum_ints_upto_n.e @@ -0,0 +1,8 @@ +int main(int n){ + int x = 0; + while ( n > 0 ){ + x = x + n; + n = n - 1; + } + return x; +} diff --git a/tests/type_basic/sum_ints_upto_n.e.expect_14_12_3_8_12 b/tests/type_basic/sum_ints_upto_n.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..a08d9717d65d4797ad102ce92e8b9149efd0799c --- /dev/null +++ b/tests/type_basic/sum_ints_upto_n.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 105} \ No newline at end of file diff --git a/tests/type_basic/sum_ints_upto_n.e.expect_1_2_3 b/tests/type_basic/sum_ints_upto_n.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/sum_ints_upto_n.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/sum_ints_upto_n.e.expect_lexer b/tests/type_basic/sum_ints_upto_n.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..df81683ba742fbf6723e2424c1325dfbf9e4a86a --- /dev/null +++ b/tests/type_basic/sum_ints_upto_n.e.expect_lexer @@ -0,0 +1,37 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_IDENTIFIER(n) +SYM_ASSIGN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/syntaxerror1.e b/tests/type_basic/syntaxerror1.e new file mode 100644 index 0000000000000000000000000000000000000000..bcda785dacdedfebb5eb5d3079a5761524f01547 --- /dev/null +++ b/tests/type_basic/syntaxerror1.e @@ -0,0 +1,4 @@ +int main(){ + int b = 3 a; + return b; +} diff --git a/tests/type_basic/syntaxerror1.e.expect_lexer b/tests/type_basic/syntaxerror1.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..877f0e9515a81648d79c4f910a3b7e1c40c2d44e --- /dev/null +++ b/tests/type_basic/syntaxerror1.e.expect_lexer @@ -0,0 +1,16 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_IDENTIFIER(a) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(b) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/syntaxerror2.e b/tests/type_basic/syntaxerror2.e new file mode 100644 index 0000000000000000000000000000000000000000..97ad20e9602d1e29bbfd18a47180ee881ecd413b --- /dev/null +++ b/tests/type_basic/syntaxerror2.e @@ -0,0 +1,4 @@ +int main(){ + int a b = 3; + return c; +} diff --git a/tests/type_basic/syntaxerror2.e.expect_lexer b/tests/type_basic/syntaxerror2.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..e8d7ade4d19e0d1e8a2b308c43441339fbacfa0b --- /dev/null +++ b/tests/type_basic/syntaxerror2.e.expect_lexer @@ -0,0 +1,16 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(a) +SYM_IDENTIFIER(b) +SYM_ASSIGN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(c) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/type_error1.e b/tests/type_basic/type_error1.e new file mode 100644 index 0000000000000000000000000000000000000000..d1a92cf2026ece541730124d1711eac9259c77e6 --- /dev/null +++ b/tests/type_basic/type_error1.e @@ -0,0 +1,6 @@ +void f(int x){ + print(x); +} +int main(){ + return f(3); +} diff --git a/tests/type_basic/type_error1.e.expect_lexer b/tests/type_basic/type_error1.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..acdae70cdbdda5cc06a35883befbbb09eb01a06f --- /dev/null +++ b/tests/type_basic/type_error1.e.expect_lexer @@ -0,0 +1,26 @@ +SYM_VOID +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/type_error2.e b/tests/type_basic/type_error2.e new file mode 100644 index 0000000000000000000000000000000000000000..26ac483ea8804823830ac90c0c3026c5462b2c4a --- /dev/null +++ b/tests/type_basic/type_error2.e @@ -0,0 +1,7 @@ +void f(int x){ + print(x); +} +int main(){ + int x = f(3); + return x; +} diff --git a/tests/type_basic/type_error2.e.expect_lexer b/tests/type_basic/type_error2.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..49a279e52bc3bc921d706d84bf19c8c98d8c7a5e --- /dev/null +++ b/tests/type_basic/type_error2.e.expect_lexer @@ -0,0 +1,31 @@ +SYM_VOID +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/type_error3.e b/tests/type_basic/type_error3.e new file mode 100644 index 0000000000000000000000000000000000000000..666401887b249f452d2f32b3f1bd3b9ce3a941a5 --- /dev/null +++ b/tests/type_basic/type_error3.e @@ -0,0 +1,8 @@ +void f(int x){ + print(x); + return x; +} +int main(){ + int x = f(3); + return x; +} diff --git a/tests/type_basic/type_error3.e.expect_lexer b/tests/type_basic/type_error3.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..239dfef22174a674f3b7402c436a047144dd1272 --- /dev/null +++ b/tests/type_basic/type_error3.e.expect_lexer @@ -0,0 +1,34 @@ +SYM_VOID +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/type_error4.e b/tests/type_basic/type_error4.e new file mode 100644 index 0000000000000000000000000000000000000000..83e427f1426662841c885396d56487db904e2854 --- /dev/null +++ b/tests/type_basic/type_error4.e @@ -0,0 +1,6 @@ +int f(int x, int y){ + return x + y; +} +int main(){ + return f(3,4,5); +} diff --git a/tests/type_basic/type_error4.e.expect_lexer b/tests/type_basic/type_error4.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..98040396526e471ee6b5c6c7a0f32d183fad6996 --- /dev/null +++ b/tests/type_basic/type_error4.e.expect_lexer @@ -0,0 +1,33 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INTEGER(3) +SYM_COMMA +SYM_INTEGER(4) +SYM_COMMA +SYM_INTEGER(5) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/uninitialized.e b/tests/type_basic/uninitialized.e new file mode 100644 index 0000000000000000000000000000000000000000..97f78d3533f9c0a046b2075c103dd430665bc257 --- /dev/null +++ b/tests/type_basic/uninitialized.e @@ -0,0 +1,3 @@ +int main(){ + return a+3; +} diff --git a/tests/type_basic/uninitialized.e.expect_14_12_3_8_12 b/tests/type_basic/uninitialized.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..fdcca39194253835c20ceda8eb3895b4b10e5a5e --- /dev/null +++ b/tests/type_basic/uninitialized.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": "Unknown variable a\n", "retval": null} \ No newline at end of file diff --git a/tests/type_basic/uninitialized.e.expect_1_2_3 b/tests/type_basic/uninitialized.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..fdcca39194253835c20ceda8eb3895b4b10e5a5e --- /dev/null +++ b/tests/type_basic/uninitialized.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": "Unknown variable a\n", "retval": null} \ No newline at end of file diff --git a/tests/type_basic/uninitialized.e.expect_lexer b/tests/type_basic/uninitialized.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..29c2bad43bafe9fa837d2262cefa10370720f1ac --- /dev/null +++ b/tests/type_basic/uninitialized.e.expect_lexer @@ -0,0 +1,12 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(a) +SYM_PLUS +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/useless-assigns.e b/tests/type_basic/useless-assigns.e new file mode 100644 index 0000000000000000000000000000000000000000..27e8a87973956508797a24dfadca4a4b23abdc86 --- /dev/null +++ b/tests/type_basic/useless-assigns.e @@ -0,0 +1,6 @@ +int main(){ + int x = 8; + int y = 15; + int z = 4 * x + y; + return 1; +} diff --git a/tests/type_basic/useless-assigns.e.expect_14_12_3_8_12 b/tests/type_basic/useless-assigns.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/useless-assigns.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/useless-assigns.e.expect_1_2_3 b/tests/type_basic/useless-assigns.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_basic/useless-assigns.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_basic/useless-assigns.e.expect_lexer b/tests/type_basic/useless-assigns.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..09ba8e3a37a4357b1f4b2736f1a89499cd0a067c --- /dev/null +++ b/tests/type_basic/useless-assigns.e.expect_lexer @@ -0,0 +1,29 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(8) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(y) +SYM_ASSIGN +SYM_INTEGER(15) +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(z) +SYM_ASSIGN +SYM_INTEGER(4) +SYM_ASTERISK +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_IDENTIFIER(y) +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/void-var.e b/tests/type_basic/void-var.e new file mode 100644 index 0000000000000000000000000000000000000000..70749176e7b0d90f04b7ff2fdfc05352c3cf702a --- /dev/null +++ b/tests/type_basic/void-var.e @@ -0,0 +1,4 @@ +int main(){ + void x; + return 0; +} diff --git a/tests/type_basic/void-var.e.expect_lexer b/tests/type_basic/void-var.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..fd86695a9cc840c04889925c8482b370e64ba403 --- /dev/null +++ b/tests/type_basic/void-var.e.expect_lexer @@ -0,0 +1,13 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_VOID +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_basic/x-is-what.e b/tests/type_basic/x-is-what.e new file mode 100644 index 0000000000000000000000000000000000000000..7734d64a24a6a06e2aa088a5d4a229930f1d0d6a --- /dev/null +++ b/tests/type_basic/x-is-what.e @@ -0,0 +1,5 @@ +int main(){ + int x = 5; + x = 6; + return x; +} diff --git a/tests/type_basic/x-is-what.e.expect_14_12_3_8_12 b/tests/type_basic/x-is-what.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..0334e56678aa50466b3b300e6bd05aacdc63e69e --- /dev/null +++ b/tests/type_basic/x-is-what.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 6} \ No newline at end of file diff --git a/tests/type_basic/x-is-what.e.expect_1_2_3 b/tests/type_basic/x-is-what.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..0334e56678aa50466b3b300e6bd05aacdc63e69e --- /dev/null +++ b/tests/type_basic/x-is-what.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "", "error": null, "retval": 6} \ No newline at end of file diff --git a/tests/type_basic/x-is-what.e.expect_lexer b/tests/type_basic/x-is-what.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..6ec0d9ad9c9a7d21d035ba7121a1bc65fd05cc1d --- /dev/null +++ b/tests/type_basic/x-is-what.e.expect_lexer @@ -0,0 +1,19 @@ +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(5) +SYM_SEMICOLON +SYM_IDENTIFIER(x) +SYM_ASSIGN +SYM_INTEGER(6) +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_funcall/2apb.e b/tests/type_funcall/2apb.e new file mode 100644 index 0000000000000000000000000000000000000000..47c1bbb7a7a3fddd510c54da981450fc68e6ebb3 --- /dev/null +++ b/tests/type_funcall/2apb.e @@ -0,0 +1,6 @@ +int f(int a, int b){ + return a + 2 * b; +} +int main(){ + return f(8,3); +} diff --git a/tests/type_funcall/2apb.e.expect_14_12_3_8_12 b/tests/type_funcall/2apb.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..e2ce8007751569ecec00e7bfdaad1980596cc9f4 --- /dev/null +++ b/tests/type_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/type_funcall/2apb.e.expect_1_2_3 b/tests/type_funcall/2apb.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..e2ce8007751569ecec00e7bfdaad1980596cc9f4 --- /dev/null +++ b/tests/type_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/type_funcall/2apb.e.expect_lexer b/tests/type_funcall/2apb.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..5031f5493923512ebbe0f2256f08fd73bb6bbe12 --- /dev/null +++ b/tests/type_funcall/2apb.e.expect_lexer @@ -0,0 +1,33 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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_INT +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_EOF diff --git a/tests/type_funcall/5args.e b/tests/type_funcall/5args.e new file mode 100644 index 0000000000000000000000000000000000000000..52154e21d0ea26479f7ed09a08b825d911ca901d --- /dev/null +++ b/tests/type_funcall/5args.e @@ -0,0 +1,6 @@ +int f(int x, int y, int z, int t, int u){ + return x + y + z + t + u; +} +int main(int x, int y){ + return f(x,x,y,y,x*2); +} diff --git a/tests/type_funcall/5args.e.expect_14_12_3_8_12 b/tests/type_funcall/5args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..e9a8021a60099904d6f192b40d0dda3f401ac4ee --- /dev/null +++ b/tests/type_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/type_funcall/5args.e.expect_1_2_3 b/tests/type_funcall/5args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..61b83a85dd0aeeb0ff59aaeb795875114625cdf7 --- /dev/null +++ b/tests/type_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/type_funcall/5args.e.expect_lexer b/tests/type_funcall/5args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..e148e3b372537f23a890880ce643a3abf2c895f2 --- /dev/null +++ b/tests/type_funcall/5args.e.expect_lexer @@ -0,0 +1,59 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(y) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(z) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(t) +SYM_COMMA +SYM_INT +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_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +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_EOF diff --git a/tests/type_funcall/argswap.e b/tests/type_funcall/argswap.e new file mode 100644 index 0000000000000000000000000000000000000000..00b8178cee160e8acd4105f79c02f38a17b2eb45 --- /dev/null +++ b/tests/type_funcall/argswap.e @@ -0,0 +1,13 @@ +int g(int a,int b){ + print(a); + print(b); + return (b - a); +} +int f(int a, int b){ + print(a); + print(b); + return g(b, a); +} +int main(int x, int y){ + return f(x, y); +} diff --git a/tests/type_funcall/argswap.e.expect_14_12_3_8_12 b/tests/type_funcall/argswap.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..38f595af3b9b89775ee2efca6d8e1d1496063200 --- /dev/null +++ b/tests/type_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/type_funcall/argswap.e.expect_1_2_3 b/tests/type_funcall/argswap.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..e03517fa033505d7fdef39702e40d4ccf9422e76 --- /dev/null +++ b/tests/type_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/type_funcall/argswap.e.expect_lexer b/tests/type_funcall/argswap.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..01324217ebee2ab5dc71be5e6174552a65980a99 --- /dev/null +++ b/tests/type_funcall/argswap.e.expect_lexer @@ -0,0 +1,77 @@ +SYM_INT +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_COMMA +SYM_INT +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/type_funcall/even_more_args.e b/tests/type_funcall/even_more_args.e new file mode 100644 index 0000000000000000000000000000000000000000..8a9c1fefbac2bff6c16133b4a4af4ac521a040f4 --- /dev/null +++ b/tests/type_funcall/even_more_args.e @@ -0,0 +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 + ){ + return (k * (a + b * c + d * e * f + g * h * i * j) + (l + m * n) * o + p * q) * (r + s * t); +} + +int 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/type_funcall/even_more_args.e.expect_14_12_3_8_12 b/tests/type_funcall/even_more_args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1705ac5b63d7e3c645cc187264daf2b0610faa2a --- /dev/null +++ b/tests/type_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/type_funcall/even_more_args.e.expect_1_2_3 b/tests/type_funcall/even_more_args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..1705ac5b63d7e3c645cc187264daf2b0610faa2a --- /dev/null +++ b/tests/type_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/type_funcall/even_more_args.e.expect_lexer b/tests/type_funcall/even_more_args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..82bef8adbe765f2650c10c2ce1fcc5978b21cda5 --- /dev/null +++ b/tests/type_funcall/even_more_args.e.expect_lexer @@ -0,0 +1,165 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(c) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(d) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(e) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(f) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(g) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(h) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(i) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(j) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(k) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(l) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(m) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(n) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(o) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(p) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(q) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(r) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(s) +SYM_COMMA +SYM_INT +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_INT +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/type_funcall/f+g.e b/tests/type_funcall/f+g.e new file mode 100644 index 0000000000000000000000000000000000000000..8a6f91bb4ccba3f6c8999f8e0e62289660803e10 --- /dev/null +++ b/tests/type_funcall/f+g.e @@ -0,0 +1,10 @@ +int f(int x){ + return x + 2; +} +int g(int y){ + return y * 3; +} +int main(){ + return f(8) + g(5); +} + diff --git a/tests/type_funcall/f+g.e.expect_14_12_3_8_12 b/tests/type_funcall/f+g.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..c24e9b82dd8efe186dc84230615b92ea22fee674 --- /dev/null +++ b/tests/type_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/type_funcall/f+g.e.expect_1_2_3 b/tests/type_funcall/f+g.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..c24e9b82dd8efe186dc84230615b92ea22fee674 --- /dev/null +++ b/tests/type_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/type_funcall/f+g.e.expect_lexer b/tests/type_funcall/f+g.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..cdb1ed6f18cdfc244074d35a3ed7ff2a63cdb7cc --- /dev/null +++ b/tests/type_funcall/f+g.e.expect_lexer @@ -0,0 +1,44 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_PLUS +SYM_INTEGER(2) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(y) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(y) +SYM_ASTERISK +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +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/type_funcall/f_3.e b/tests/type_funcall/f_3.e new file mode 100644 index 0000000000000000000000000000000000000000..8dc310fbe0557f2f5b1dffe5babd7584dca4b17b --- /dev/null +++ b/tests/type_funcall/f_3.e @@ -0,0 +1,6 @@ +int f(){ + return 3; +} +int main(){ + return f(); +} diff --git a/tests/type_funcall/f_3.e.expect_14_12_3_8_12 b/tests/type_funcall/f_3.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/type_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/type_funcall/f_3.e.expect_1_2_3 b/tests/type_funcall/f_3.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..ff173ecdb8373e909da3d38e30940db4a55a4f2d --- /dev/null +++ b/tests/type_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/type_funcall/f_3.e.expect_lexer b/tests/type_funcall/f_3.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..642da6e4ac2ef8ce7c0ed5c000b3612b040656cd --- /dev/null +++ b/tests/type_funcall/f_3.e.expect_lexer @@ -0,0 +1,21 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(3) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_funcall/fib.e b/tests/type_funcall/fib.e new file mode 100644 index 0000000000000000000000000000000000000000..fd6aa2e2f50895c37435bfed0d7f5b836d834b4c --- /dev/null +++ b/tests/type_funcall/fib.e @@ -0,0 +1,11 @@ +int fib(int n){ + if(n > 14){ return -1; } + if(n <= 2){ + return 1; + } else { + return fib(n-1) + fib(n-2); + } +} +int main(int n){ + return fib(n); +} diff --git a/tests/type_funcall/fib.e.expect_14_12_3_8_12 b/tests/type_funcall/fib.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..1fef2374b55b0d9496617cec0a857a07906f799f --- /dev/null +++ b/tests/type_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/type_funcall/fib.e.expect_1_2_3 b/tests/type_funcall/fib.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_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/type_funcall/fib.e.expect_lexer b/tests/type_funcall/fib.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..700aacb0e050255cd7873a6660dcfdfeeaea4292 --- /dev/null +++ b/tests/type_funcall/fib.e.expect_lexer @@ -0,0 +1,64 @@ +SYM_INT +SYM_IDENTIFIER(fib) +SYM_LPARENTHESIS +SYM_INT +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_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +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/type_funcall/gcdrec.e b/tests/type_funcall/gcdrec.e new file mode 100644 index 0000000000000000000000000000000000000000..2eef179519dd04a0c2502c554f8f7e47b46506e9 --- /dev/null +++ b/tests/type_funcall/gcdrec.e @@ -0,0 +1,10 @@ +int gcd(int a, int b){ + if(b == 0){ + return a; + } else { + return gcd(b, a % b); + } +} +int main(int a, int b){ + return gcd(a,b); +} diff --git a/tests/type_funcall/gcdrec.e.expect_14_12_3_8_12 b/tests/type_funcall/gcdrec.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..df1c5a5ba4e1647c7e3409ee9539a3583afa9bdf --- /dev/null +++ b/tests/type_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/type_funcall/gcdrec.e.expect_1_2_3 b/tests/type_funcall/gcdrec.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_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/type_funcall/gcdrec.e.expect_lexer b/tests/type_funcall/gcdrec.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..7b5f13aa8d309486b8fff1ec35c276a7ae76a844 --- /dev/null +++ b/tests/type_funcall/gcdrec.e.expect_lexer @@ -0,0 +1,55 @@ +SYM_INT +SYM_IDENTIFIER(gcd) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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/type_funcall/hanoi.e b/tests/type_funcall/hanoi.e new file mode 100644 index 0000000000000000000000000000000000000000..c6edfbc127d58715b354a3913c394e6658f545fb --- /dev/null +++ b/tests/type_funcall/hanoi.e @@ -0,0 +1,12 @@ +int hanoi(int n) +{ + if(n > 0) + { + int x = hanoi(n-1); + return 1 + 2 * x; + } + return 0; +} +int main(int ndisque){ + return hanoi(ndisque); +} diff --git a/tests/type_funcall/hanoi.e.expect_14_12_3_8_12 b/tests/type_funcall/hanoi.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..7cf52b9a4706e4fab8abce3869595d4e4b3ceb36 --- /dev/null +++ b/tests/type_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/type_funcall/hanoi.e.expect_1_2_3 b/tests/type_funcall/hanoi.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..91ce1a2bdbf38470155456d0bd691bff3912e2c6 --- /dev/null +++ b/tests/type_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/type_funcall/hanoi.e.expect_lexer b/tests/type_funcall/hanoi.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..ca101e68e30473c302921ea26662598bc96bacca --- /dev/null +++ b/tests/type_funcall/hanoi.e.expect_lexer @@ -0,0 +1,51 @@ +SYM_INT +SYM_IDENTIFIER(hanoi) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +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_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(ndisque) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(hanoi) +SYM_LPARENTHESIS +SYM_IDENTIFIER(ndisque) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_funcall/lots_of_args.e b/tests/type_funcall/lots_of_args.e new file mode 100644 index 0000000000000000000000000000000000000000..a03f3412b4a5ac82cdeba3ee2ca7521c96e1a9de --- /dev/null +++ b/tests/type_funcall/lots_of_args.e @@ -0,0 +1,17 @@ +int f(int a, + int b, + int c, + int d, + int e, + int f, + int g, + int h, + int i, + int j + ){ + return a + b * c + d * e * f + g * h * i * j; +} + +int main(){ + return f(1,2,3,4,5,6,7,8,9,10); +} diff --git a/tests/type_funcall/lots_of_args.e.expect_14_12_3_8_12 b/tests/type_funcall/lots_of_args.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..16d63e1a7da8f2cb086a0d601046966b4a6c4003 --- /dev/null +++ b/tests/type_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/type_funcall/lots_of_args.e.expect_1_2_3 b/tests/type_funcall/lots_of_args.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..16d63e1a7da8f2cb086a0d601046966b4a6c4003 --- /dev/null +++ b/tests/type_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/type_funcall/lots_of_args.e.expect_lexer b/tests/type_funcall/lots_of_args.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..e9ed44ec07cdc4ea42cb16109b9a0a1f460d9c53 --- /dev/null +++ b/tests/type_funcall/lots_of_args.e.expect_lexer @@ -0,0 +1,87 @@ +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(b) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(c) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(d) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(e) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(f) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(g) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(h) +SYM_COMMA +SYM_INT +SYM_IDENTIFIER(i) +SYM_COMMA +SYM_INT +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_INT +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/type_funcall/mutrec-hofstadter.e b/tests/type_funcall/mutrec-hofstadter.e new file mode 100644 index 0000000000000000000000000000000000000000..7e476257e5c051a9800fa88ee607a0707e7333b5 --- /dev/null +++ b/tests/type_funcall/mutrec-hofstadter.e @@ -0,0 +1,32 @@ +int m(int n); + +int f(int n) { + if (n >= 0){ + if (n == 0){ + return 1; + } else { + return n - m(f(n-1)); + } + } + return 0; +} + +int m(int n) { + if (n >= 0){ + if (n == 0){ + return 0; + } else { + return n - f(m(n-1)); + } + } + return 0; +} + +int main(int n){ + int i = 0; + while(i < n) { + print(f(i)); + i = i + 1; + } + return 0; +} diff --git a/tests/type_funcall/mutrec-hofstadter.e.expect_14_12_3_8_12 b/tests/type_funcall/mutrec-hofstadter.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..123726a93fd2b95023161ce0d1d095073aeadf46 --- /dev/null +++ b/tests/type_funcall/mutrec-hofstadter.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "1\n1\n2\n2\n3\n3\n4\n5\n5\n6\n6\n7\n8\n8\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_funcall/mutrec-hofstadter.e.expect_1_2_3 b/tests/type_funcall/mutrec-hofstadter.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..eb1504dc83ea5564e4adb5e00344555cd86cc389 --- /dev/null +++ b/tests/type_funcall/mutrec-hofstadter.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "1\n", "error": null, "retval": 0} \ No newline at end of file diff --git a/tests/type_funcall/mutrec-hofstadter.e.expect_lexer b/tests/type_funcall/mutrec-hofstadter.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..1e95da562e92f085846af9d626c98e59cf44b3f9 --- /dev/null +++ b/tests/type_funcall/mutrec-hofstadter.e.expect_lexer @@ -0,0 +1,138 @@ +SYM_INT +SYM_IDENTIFIER(m) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GEQ +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_IDENTIFIER(m) +SYM_LPARENTHESIS +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(m) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GEQ +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_ELSE +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(m) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_INT +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_WHILE +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_LT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_IDENTIFIER(i) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_IDENTIFIER(i) +SYM_ASSIGN +SYM_IDENTIFIER(i) +SYM_PLUS +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_funcall/mutrec.e b/tests/type_funcall/mutrec.e new file mode 100644 index 0000000000000000000000000000000000000000..6e5cb314ea7d128b6b91ae3dd30678c28f262c49 --- /dev/null +++ b/tests/type_funcall/mutrec.e @@ -0,0 +1,26 @@ +int even(int n); + +int odd(int n){ + if (n > 0) { + if (n == 1) { + return 1; + } + return even(n-1); + } + return 0; +} + +int even(int n){ + if (n >= 0) { + if (n == 0) { + return 1; + } + return odd(n-1); + } + return 0; +} + +int main(int n){ + print(even(n)); + return n; +} diff --git a/tests/type_funcall/mutrec.e.expect_14_12_3_8_12 b/tests/type_funcall/mutrec.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..c5e79f77b18cef40e21691ac36c4f958f949baee --- /dev/null +++ b/tests/type_funcall/mutrec.e.expect_14_12_3_8_12 @@ -0,0 +1 @@ +{"output": "1\n", "error": null, "retval": 14} \ No newline at end of file diff --git a/tests/type_funcall/mutrec.e.expect_1_2_3 b/tests/type_funcall/mutrec.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..b856e348e51715384775956823cf979f85860da0 --- /dev/null +++ b/tests/type_funcall/mutrec.e.expect_1_2_3 @@ -0,0 +1 @@ +{"output": "0\n", "error": null, "retval": 1} \ No newline at end of file diff --git a/tests/type_funcall/mutrec.e.expect_lexer b/tests/type_funcall/mutrec.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..c288508bbfeda041b0f25faab0317a5db08fa25e --- /dev/null +++ b/tests/type_funcall/mutrec.e.expect_lexer @@ -0,0 +1,103 @@ +SYM_INT +SYM_IDENTIFIER(even) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_INT +SYM_IDENTIFIER(odd) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GT +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_EQUALITY +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(even) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(even) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_GEQ +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IF +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_EQUALITY +SYM_INTEGER(0) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_INTEGER(1) +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_IDENTIFIER(odd) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_MINUS +SYM_INTEGER(1) +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RBRACE +SYM_RETURN +SYM_INTEGER(0) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(main) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_IDENTIFIER(print) +SYM_LPARENTHESIS +SYM_IDENTIFIER(even) +SYM_LPARENTHESIS +SYM_IDENTIFIER(n) +SYM_RPARENTHESIS +SYM_RPARENTHESIS +SYM_SEMICOLON +SYM_RETURN +SYM_IDENTIFIER(n) +SYM_SEMICOLON +SYM_RBRACE +SYM_EOF diff --git a/tests/type_funcall/print_and_fun.e b/tests/type_funcall/print_and_fun.e new file mode 100644 index 0000000000000000000000000000000000000000..4e58317c10e80a3dfb895ce6354c090fb42b2432 --- /dev/null +++ b/tests/type_funcall/print_and_fun.e @@ -0,0 +1,16 @@ + +int g(int x){ + return x; +} + +int f(int a, int b){ + b = g(8); + print(a); + print(b); + return 0; +} + +int main(){ + f(3,4); + return 0; +} diff --git a/tests/type_funcall/print_and_fun.e.expect_14_12_3_8_12 b/tests/type_funcall/print_and_fun.e.expect_14_12_3_8_12 new file mode 100644 index 0000000000000000000000000000000000000000..7d935d7f4a3630ae710e34b79470872b1124e978 --- /dev/null +++ b/tests/type_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/type_funcall/print_and_fun.e.expect_1_2_3 b/tests/type_funcall/print_and_fun.e.expect_1_2_3 new file mode 100644 index 0000000000000000000000000000000000000000..7d935d7f4a3630ae710e34b79470872b1124e978 --- /dev/null +++ b/tests/type_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/type_funcall/print_and_fun.e.expect_lexer b/tests/type_funcall/print_and_fun.e.expect_lexer new file mode 100644 index 0000000000000000000000000000000000000000..5c3dd6a863982dab29b0f2874c9d54a9920eb516 --- /dev/null +++ b/tests/type_funcall/print_and_fun.e.expect_lexer @@ -0,0 +1,59 @@ +SYM_INT +SYM_IDENTIFIER(g) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(x) +SYM_RPARENTHESIS +SYM_LBRACE +SYM_RETURN +SYM_IDENTIFIER(x) +SYM_SEMICOLON +SYM_RBRACE +SYM_INT +SYM_IDENTIFIER(f) +SYM_LPARENTHESIS +SYM_INT +SYM_IDENTIFIER(a) +SYM_COMMA +SYM_INT +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_INT +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