From 4a8239190164ffd4557c4b03ebb62c13aa8314e1 Mon Sep 17 00:00:00 2001 From: Pierre Wilke <pierre.wilke@centralesupelec.fr> Date: Fri, 20 Mar 2020 11:07:23 +0100 Subject: [PATCH] tests type --- tests/char/char.e | 2 +- tests/char/char.e.expect_14_12_3_8_12 | 1 + tests/char/char.e.expect_1_2_3 | 1 + tests/char/char.e.expect_lexer | 20 +++ tests/char/char2.e | 5 + tests/char/char2.e.expect_14_12_3_8_12 | 1 + tests/char/char2.e.expect_1_2_3 | 1 + tests/char/char2.e.expect_lexer | 22 +++ tests/char/char_fun.e | 2 +- tests/char/char_fun.e.expect_14_12_3_8_12 | 1 + tests/char/char_fun.e.expect_1_2_3 | 1 + tests/char/char_fun.e.expect_lexer | 31 ++++ tests/type_basic/1_or_3a.e | 6 + .../type_basic/1_or_3a.e.expect_14_12_3_8_12 | 1 + tests/type_basic/1_or_3a.e.expect_1_2_3 | 1 + tests/type_basic/1_or_3a.e.expect_lexer | 33 ++++ tests/type_basic/1_or_4.e | 17 ++ tests/type_basic/1_or_4.e.expect_14_12_3_8_12 | 1 + tests/type_basic/1_or_4.e.expect_1_2_3 | 1 + tests/type_basic/1_or_4.e.expect_lexer | 64 +++++++ tests/type_basic/2xpy.e | 3 + tests/type_basic/2xpy.e.expect_14_12_3_8_12 | 1 + tests/type_basic/2xpy.e.expect_1_2_3 | 1 + tests/type_basic/2xpy.e.expect_lexer | 19 ++ tests/type_basic/35gt12.e | 7 + tests/type_basic/35gt12.e.expect_14_12_3_8_12 | 1 + tests/type_basic/35gt12.e.expect_1_2_3 | 1 + tests/type_basic/35gt12.e.expect_lexer | 38 ++++ tests/type_basic/a_19.e | 4 + tests/type_basic/a_19.e.expect_14_12_3_8_12 | 1 + tests/type_basic/a_19.e.expect_1_2_3 | 1 + tests/type_basic/a_19.e.expect_lexer | 27 +++ tests/type_basic/a_simple_variable_23.e | 4 + ...a_simple_variable_23.e.expect_14_12_3_8_12 | 1 + .../a_simple_variable_23.e.expect_1_2_3 | 1 + .../a_simple_variable_23.e.expect_lexer | 19 ++ tests/type_basic/arg-test.e | 15 ++ .../type_basic/arg-test.e.expect_14_12_3_8_12 | 1 + tests/type_basic/arg-test.e.expect_1_2_3 | 1 + tests/type_basic/arg-test.e.expect_lexer | 65 +++++++ tests/type_basic/comment++.e | 5 + .../comment++.e.expect_14_12_3_8_12 | 1 + tests/type_basic/comment++.e.expect_1_2_3 | 1 + tests/type_basic/comment++.e.expect_lexer | 10 ++ tests/type_basic/comment.e | 6 + .../type_basic/comment.e.expect_14_12_3_8_12 | 1 + tests/type_basic/comment.e.expect_1_2_3 | 1 + tests/type_basic/comment.e.expect_lexer | 14 ++ tests/type_basic/dec_to_0.e | 6 + .../type_basic/dec_to_0.e.expect_14_12_3_8_12 | 1 + tests/type_basic/dec_to_0.e.expect_1_2_3 | 1 + tests/type_basic/dec_to_0.e.expect_lexer | 26 +++ tests/type_basic/double.e | 4 + tests/type_basic/double.e.expect_14_12_3_8_12 | 1 + tests/type_basic/double.e.expect_1_2_3 | 1 + tests/type_basic/double.e.expect_lexer | 18 ++ tests/type_basic/fac.e | 12 ++ tests/type_basic/fac.e.expect_14_12_3_8_12 | 1 + tests/type_basic/fac.e.expect_1_2_3 | 1 + tests/type_basic/fac.e.expect_lexer | 52 ++++++ tests/type_basic/fibbetter.e | 12 ++ .../fibbetter.e.expect_14_12_3_8_12 | 1 + tests/type_basic/fibbetter.e.expect_1_2_3 | 1 + tests/type_basic/fibbetter.e.expect_lexer | 56 ++++++ tests/type_basic/gcd.e | 9 + tests/type_basic/gcd.e.expect_14_12_3_8_12 | 1 + tests/type_basic/gcd.e.expect_1_2_3 | 1 + tests/type_basic/gcd.e.expect_lexer | 40 +++++ tests/type_basic/just_a_variable_37.e | 4 + .../just_a_variable_37.e.expect_14_12_3_8_12 | 1 + .../just_a_variable_37.e.expect_1_2_3 | 1 + .../just_a_variable_37.e.expect_lexer | 15 ++ tests/type_basic/lexerror.e | 1 + tests/type_basic/loop.e | 15 ++ tests/type_basic/loop.e.expect_14_12_3_8_12 | 1 + tests/type_basic/loop.e.expect_1_2_3 | 1 + tests/type_basic/loop.e.expect_lexer | 69 ++++++++ tests/type_basic/loop2.e | 13 ++ tests/type_basic/loop2.e.expect_14_12_3_8_12 | 1 + tests/type_basic/loop2.e.expect_1_2_3 | 1 + tests/type_basic/loop2.e.expect_lexer | 51 ++++++ tests/type_basic/loop3.e | 14 ++ tests/type_basic/loop3.e.expect_14_12_3_8_12 | 1 + tests/type_basic/loop3.e.expect_1_2_3 | 1 + tests/type_basic/loop3.e.expect_lexer | 64 +++++++ tests/type_basic/loop4.e | 20 +++ tests/type_basic/loop4.e.expect_14_12_3_8_12 | 1 + tests/type_basic/loop4.e.expect_1_2_3 | 1 + tests/type_basic/loop4.e.expect_lexer | 95 ++++++++++ tests/type_basic/lots-of-regs.e | 21 +++ .../lots-of-regs.e.expect_14_12_3_8_12 | 1 + tests/type_basic/lots-of-regs.e.expect_1_2_3 | 1 + tests/type_basic/lots-of-regs.e.expect_lexer | 165 ++++++++++++++++++ tests/type_basic/muldivmod.e | 5 + .../muldivmod.e.expect_14_12_3_8_12 | 1 + tests/type_basic/muldivmod.e.expect_1_2_3 | 1 + tests/type_basic/muldivmod.e.expect_lexer | 28 +++ tests/type_basic/mulmulmul.e | 3 + .../mulmulmul.e.expect_14_12_3_8_12 | 1 + tests/type_basic/mulmulmul.e.expect_1_2_3 | 1 + tests/type_basic/mulmulmul.e.expect_lexer | 28 +++ tests/type_basic/prime.e | 20 +++ tests/type_basic/prime.e.expect_14_12_3_8_12 | 1 + tests/type_basic/prime.e.expect_1_2_3 | 1 + tests/type_basic/prime.e.expect_lexer | 96 ++++++++++ tests/type_basic/print_int.e | 4 + .../print_int.e.expect_14_12_3_8_12 | 1 + tests/type_basic/print_int.e.expect_1_2_3 | 1 + tests/type_basic/print_int.e.expect_lexer | 15 ++ tests/type_basic/range_0_10.e | 8 + .../range_0_10.e.expect_14_12_3_8_12 | 1 + tests/type_basic/range_0_10.e.expect_1_2_3 | 1 + tests/type_basic/range_0_10.e.expect_lexer | 42 +++++ tests/type_basic/range_10_0_then_dec0.e | 11 ++ ...range_10_0_then_dec0.e.expect_14_12_3_8_12 | 1 + .../range_10_0_then_dec0.e.expect_1_2_3 | 1 + .../range_10_0_then_dec0.e.expect_lexer | 56 ++++++ tests/type_basic/ret0.e | 3 + tests/type_basic/ret0.e.expect_14_12_3_8_12 | 1 + tests/type_basic/ret0.e.expect_1_2_3 | 1 + tests/type_basic/ret0.e.expect_lexer | 10 ++ tests/type_basic/ret20.e | 6 + tests/type_basic/ret20.e.expect_14_12_3_8_12 | 1 + tests/type_basic/ret20.e.expect_1_2_3 | 1 + tests/type_basic/ret20.e.expect_lexer | 30 ++++ tests/type_basic/ret21.e | 7 + tests/type_basic/ret21.e.expect_14_12_3_8_12 | 1 + tests/type_basic/ret21.e.expect_1_2_3 | 1 + tests/type_basic/ret21.e.expect_lexer | 36 ++++ tests/type_basic/ret60.e | 5 + tests/type_basic/ret60.e.expect_14_12_3_8_12 | 1 + tests/type_basic/ret60.e.expect_1_2_3 | 1 + tests/type_basic/ret60.e.expect_lexer | 26 +++ tests/type_basic/sum_ints_upto_10.e | 13 ++ .../sum_ints_upto_10.e.expect_14_12_3_8_12 | 1 + .../sum_ints_upto_10.e.expect_1_2_3 | 1 + .../sum_ints_upto_10.e.expect_lexer | 50 ++++++ tests/type_basic/sum_ints_upto_n.e | 8 + .../sum_ints_upto_n.e.expect_14_12_3_8_12 | 1 + .../type_basic/sum_ints_upto_n.e.expect_1_2_3 | 1 + .../type_basic/sum_ints_upto_n.e.expect_lexer | 37 ++++ tests/type_basic/syntaxerror1.e | 4 + tests/type_basic/syntaxerror1.e.expect_lexer | 16 ++ tests/type_basic/syntaxerror2.e | 4 + tests/type_basic/syntaxerror2.e.expect_lexer | 16 ++ tests/type_basic/type_error1.e | 6 + tests/type_basic/type_error1.e.expect_lexer | 26 +++ tests/type_basic/type_error2.e | 7 + tests/type_basic/type_error2.e.expect_lexer | 31 ++++ tests/type_basic/type_error3.e | 8 + tests/type_basic/type_error3.e.expect_lexer | 34 ++++ tests/type_basic/type_error4.e | 6 + tests/type_basic/type_error4.e.expect_lexer | 33 ++++ tests/type_basic/uninitialized.e | 3 + .../uninitialized.e.expect_14_12_3_8_12 | 1 + tests/type_basic/uninitialized.e.expect_1_2_3 | 1 + tests/type_basic/uninitialized.e.expect_lexer | 12 ++ tests/type_basic/useless-assigns.e | 6 + .../useless-assigns.e.expect_14_12_3_8_12 | 1 + .../type_basic/useless-assigns.e.expect_1_2_3 | 1 + .../type_basic/useless-assigns.e.expect_lexer | 29 +++ tests/type_basic/void-var.e | 4 + tests/type_basic/void-var.e.expect_lexer | 13 ++ tests/type_basic/x-is-what.e | 5 + .../x-is-what.e.expect_14_12_3_8_12 | 1 + tests/type_basic/x-is-what.e.expect_1_2_3 | 1 + tests/type_basic/x-is-what.e.expect_lexer | 19 ++ tests/type_funcall/2apb.e | 6 + tests/type_funcall/2apb.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/2apb.e.expect_1_2_3 | 1 + tests/type_funcall/2apb.e.expect_lexer | 33 ++++ tests/type_funcall/5args.e | 6 + .../type_funcall/5args.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/5args.e.expect_1_2_3 | 1 + tests/type_funcall/5args.e.expect_lexer | 59 +++++++ tests/type_funcall/argswap.e | 13 ++ .../argswap.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/argswap.e.expect_1_2_3 | 1 + tests/type_funcall/argswap.e.expect_lexer | 77 ++++++++ tests/type_funcall/even_more_args.e | 27 +++ .../even_more_args.e.expect_14_12_3_8_12 | 1 + .../even_more_args.e.expect_1_2_3 | 1 + .../even_more_args.e.expect_lexer | 165 ++++++++++++++++++ tests/type_funcall/f+g.e | 10 ++ tests/type_funcall/f+g.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/f+g.e.expect_1_2_3 | 1 + tests/type_funcall/f+g.e.expect_lexer | 44 +++++ tests/type_funcall/f_3.e | 6 + tests/type_funcall/f_3.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/f_3.e.expect_1_2_3 | 1 + tests/type_funcall/f_3.e.expect_lexer | 21 +++ tests/type_funcall/fib.e | 11 ++ tests/type_funcall/fib.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/fib.e.expect_1_2_3 | 1 + tests/type_funcall/fib.e.expect_lexer | 64 +++++++ tests/type_funcall/gcdrec.e | 10 ++ .../type_funcall/gcdrec.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/gcdrec.e.expect_1_2_3 | 1 + tests/type_funcall/gcdrec.e.expect_lexer | 55 ++++++ tests/type_funcall/hanoi.e | 12 ++ .../type_funcall/hanoi.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/hanoi.e.expect_1_2_3 | 1 + tests/type_funcall/hanoi.e.expect_lexer | 51 ++++++ tests/type_funcall/lots_of_args.e | 17 ++ .../lots_of_args.e.expect_14_12_3_8_12 | 1 + .../type_funcall/lots_of_args.e.expect_1_2_3 | 1 + .../type_funcall/lots_of_args.e.expect_lexer | 87 +++++++++ tests/type_funcall/mutrec-hofstadter.e | 32 ++++ .../mutrec-hofstadter.e.expect_14_12_3_8_12 | 1 + .../mutrec-hofstadter.e.expect_1_2_3 | 1 + .../mutrec-hofstadter.e.expect_lexer | 138 +++++++++++++++ tests/type_funcall/mutrec.e | 26 +++ .../type_funcall/mutrec.e.expect_14_12_3_8_12 | 1 + tests/type_funcall/mutrec.e.expect_1_2_3 | 1 + tests/type_funcall/mutrec.e.expect_lexer | 103 +++++++++++ tests/type_funcall/print_and_fun.e | 16 ++ .../print_and_fun.e.expect_14_12_3_8_12 | 1 + .../type_funcall/print_and_fun.e.expect_1_2_3 | 1 + .../type_funcall/print_and_fun.e.expect_lexer | 59 +++++++ 219 files changed, 3297 insertions(+), 2 deletions(-) create mode 100644 tests/char/char.e.expect_14_12_3_8_12 create mode 100644 tests/char/char.e.expect_1_2_3 create mode 100644 tests/char/char.e.expect_lexer create mode 100644 tests/char/char2.e create mode 100644 tests/char/char2.e.expect_14_12_3_8_12 create mode 100644 tests/char/char2.e.expect_1_2_3 create mode 100644 tests/char/char2.e.expect_lexer create mode 100644 tests/char/char_fun.e.expect_14_12_3_8_12 create mode 100644 tests/char/char_fun.e.expect_1_2_3 create mode 100644 tests/char/char_fun.e.expect_lexer create mode 100644 tests/type_basic/1_or_3a.e create mode 100644 tests/type_basic/1_or_3a.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/1_or_3a.e.expect_1_2_3 create mode 100644 tests/type_basic/1_or_3a.e.expect_lexer create mode 100644 tests/type_basic/1_or_4.e create mode 100644 tests/type_basic/1_or_4.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/1_or_4.e.expect_1_2_3 create mode 100644 tests/type_basic/1_or_4.e.expect_lexer create mode 100644 tests/type_basic/2xpy.e create mode 100644 tests/type_basic/2xpy.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/2xpy.e.expect_1_2_3 create mode 100644 tests/type_basic/2xpy.e.expect_lexer create mode 100644 tests/type_basic/35gt12.e create mode 100644 tests/type_basic/35gt12.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/35gt12.e.expect_1_2_3 create mode 100644 tests/type_basic/35gt12.e.expect_lexer create mode 100644 tests/type_basic/a_19.e create mode 100644 tests/type_basic/a_19.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/a_19.e.expect_1_2_3 create mode 100644 tests/type_basic/a_19.e.expect_lexer create mode 100644 tests/type_basic/a_simple_variable_23.e create mode 100644 tests/type_basic/a_simple_variable_23.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/a_simple_variable_23.e.expect_1_2_3 create mode 100644 tests/type_basic/a_simple_variable_23.e.expect_lexer create mode 100644 tests/type_basic/arg-test.e create mode 100644 tests/type_basic/arg-test.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/arg-test.e.expect_1_2_3 create mode 100644 tests/type_basic/arg-test.e.expect_lexer create mode 100644 tests/type_basic/comment++.e create mode 100644 tests/type_basic/comment++.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/comment++.e.expect_1_2_3 create mode 100644 tests/type_basic/comment++.e.expect_lexer create mode 100644 tests/type_basic/comment.e create mode 100644 tests/type_basic/comment.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/comment.e.expect_1_2_3 create mode 100644 tests/type_basic/comment.e.expect_lexer create mode 100644 tests/type_basic/dec_to_0.e create mode 100644 tests/type_basic/dec_to_0.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/dec_to_0.e.expect_1_2_3 create mode 100644 tests/type_basic/dec_to_0.e.expect_lexer create mode 100644 tests/type_basic/double.e create mode 100644 tests/type_basic/double.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/double.e.expect_1_2_3 create mode 100644 tests/type_basic/double.e.expect_lexer create mode 100644 tests/type_basic/fac.e create mode 100644 tests/type_basic/fac.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/fac.e.expect_1_2_3 create mode 100644 tests/type_basic/fac.e.expect_lexer create mode 100644 tests/type_basic/fibbetter.e create mode 100644 tests/type_basic/fibbetter.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/fibbetter.e.expect_1_2_3 create mode 100644 tests/type_basic/fibbetter.e.expect_lexer create mode 100644 tests/type_basic/gcd.e create mode 100644 tests/type_basic/gcd.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/gcd.e.expect_1_2_3 create mode 100644 tests/type_basic/gcd.e.expect_lexer create mode 100644 tests/type_basic/just_a_variable_37.e create mode 100644 tests/type_basic/just_a_variable_37.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/just_a_variable_37.e.expect_1_2_3 create mode 100644 tests/type_basic/just_a_variable_37.e.expect_lexer create mode 100644 tests/type_basic/lexerror.e create mode 100644 tests/type_basic/loop.e create mode 100644 tests/type_basic/loop.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/loop.e.expect_1_2_3 create mode 100644 tests/type_basic/loop.e.expect_lexer create mode 100644 tests/type_basic/loop2.e create mode 100644 tests/type_basic/loop2.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/loop2.e.expect_1_2_3 create mode 100644 tests/type_basic/loop2.e.expect_lexer create mode 100644 tests/type_basic/loop3.e create mode 100644 tests/type_basic/loop3.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/loop3.e.expect_1_2_3 create mode 100644 tests/type_basic/loop3.e.expect_lexer create mode 100644 tests/type_basic/loop4.e create mode 100644 tests/type_basic/loop4.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/loop4.e.expect_1_2_3 create mode 100644 tests/type_basic/loop4.e.expect_lexer create mode 100644 tests/type_basic/lots-of-regs.e create mode 100644 tests/type_basic/lots-of-regs.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/lots-of-regs.e.expect_1_2_3 create mode 100644 tests/type_basic/lots-of-regs.e.expect_lexer create mode 100644 tests/type_basic/muldivmod.e create mode 100644 tests/type_basic/muldivmod.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/muldivmod.e.expect_1_2_3 create mode 100644 tests/type_basic/muldivmod.e.expect_lexer create mode 100644 tests/type_basic/mulmulmul.e create mode 100644 tests/type_basic/mulmulmul.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/mulmulmul.e.expect_1_2_3 create mode 100644 tests/type_basic/mulmulmul.e.expect_lexer create mode 100644 tests/type_basic/prime.e create mode 100644 tests/type_basic/prime.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/prime.e.expect_1_2_3 create mode 100644 tests/type_basic/prime.e.expect_lexer create mode 100644 tests/type_basic/print_int.e create mode 100644 tests/type_basic/print_int.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/print_int.e.expect_1_2_3 create mode 100644 tests/type_basic/print_int.e.expect_lexer create mode 100644 tests/type_basic/range_0_10.e create mode 100644 tests/type_basic/range_0_10.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/range_0_10.e.expect_1_2_3 create mode 100644 tests/type_basic/range_0_10.e.expect_lexer create mode 100644 tests/type_basic/range_10_0_then_dec0.e create mode 100644 tests/type_basic/range_10_0_then_dec0.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/range_10_0_then_dec0.e.expect_1_2_3 create mode 100644 tests/type_basic/range_10_0_then_dec0.e.expect_lexer create mode 100644 tests/type_basic/ret0.e create mode 100644 tests/type_basic/ret0.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/ret0.e.expect_1_2_3 create mode 100644 tests/type_basic/ret0.e.expect_lexer create mode 100644 tests/type_basic/ret20.e create mode 100644 tests/type_basic/ret20.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/ret20.e.expect_1_2_3 create mode 100644 tests/type_basic/ret20.e.expect_lexer create mode 100644 tests/type_basic/ret21.e create mode 100644 tests/type_basic/ret21.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/ret21.e.expect_1_2_3 create mode 100644 tests/type_basic/ret21.e.expect_lexer create mode 100644 tests/type_basic/ret60.e create mode 100644 tests/type_basic/ret60.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/ret60.e.expect_1_2_3 create mode 100644 tests/type_basic/ret60.e.expect_lexer create mode 100644 tests/type_basic/sum_ints_upto_10.e create mode 100644 tests/type_basic/sum_ints_upto_10.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/sum_ints_upto_10.e.expect_1_2_3 create mode 100644 tests/type_basic/sum_ints_upto_10.e.expect_lexer create mode 100644 tests/type_basic/sum_ints_upto_n.e create mode 100644 tests/type_basic/sum_ints_upto_n.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/sum_ints_upto_n.e.expect_1_2_3 create mode 100644 tests/type_basic/sum_ints_upto_n.e.expect_lexer create mode 100644 tests/type_basic/syntaxerror1.e create mode 100644 tests/type_basic/syntaxerror1.e.expect_lexer create mode 100644 tests/type_basic/syntaxerror2.e create mode 100644 tests/type_basic/syntaxerror2.e.expect_lexer create mode 100644 tests/type_basic/type_error1.e create mode 100644 tests/type_basic/type_error1.e.expect_lexer create mode 100644 tests/type_basic/type_error2.e create mode 100644 tests/type_basic/type_error2.e.expect_lexer create mode 100644 tests/type_basic/type_error3.e create mode 100644 tests/type_basic/type_error3.e.expect_lexer create mode 100644 tests/type_basic/type_error4.e create mode 100644 tests/type_basic/type_error4.e.expect_lexer create mode 100644 tests/type_basic/uninitialized.e create mode 100644 tests/type_basic/uninitialized.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/uninitialized.e.expect_1_2_3 create mode 100644 tests/type_basic/uninitialized.e.expect_lexer create mode 100644 tests/type_basic/useless-assigns.e create mode 100644 tests/type_basic/useless-assigns.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/useless-assigns.e.expect_1_2_3 create mode 100644 tests/type_basic/useless-assigns.e.expect_lexer create mode 100644 tests/type_basic/void-var.e create mode 100644 tests/type_basic/void-var.e.expect_lexer create mode 100644 tests/type_basic/x-is-what.e create mode 100644 tests/type_basic/x-is-what.e.expect_14_12_3_8_12 create mode 100644 tests/type_basic/x-is-what.e.expect_1_2_3 create mode 100644 tests/type_basic/x-is-what.e.expect_lexer create mode 100644 tests/type_funcall/2apb.e create mode 100644 tests/type_funcall/2apb.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/2apb.e.expect_1_2_3 create mode 100644 tests/type_funcall/2apb.e.expect_lexer create mode 100644 tests/type_funcall/5args.e create mode 100644 tests/type_funcall/5args.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/5args.e.expect_1_2_3 create mode 100644 tests/type_funcall/5args.e.expect_lexer create mode 100644 tests/type_funcall/argswap.e create mode 100644 tests/type_funcall/argswap.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/argswap.e.expect_1_2_3 create mode 100644 tests/type_funcall/argswap.e.expect_lexer create mode 100644 tests/type_funcall/even_more_args.e create mode 100644 tests/type_funcall/even_more_args.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/even_more_args.e.expect_1_2_3 create mode 100644 tests/type_funcall/even_more_args.e.expect_lexer create mode 100644 tests/type_funcall/f+g.e create mode 100644 tests/type_funcall/f+g.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/f+g.e.expect_1_2_3 create mode 100644 tests/type_funcall/f+g.e.expect_lexer create mode 100644 tests/type_funcall/f_3.e create mode 100644 tests/type_funcall/f_3.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/f_3.e.expect_1_2_3 create mode 100644 tests/type_funcall/f_3.e.expect_lexer create mode 100644 tests/type_funcall/fib.e create mode 100644 tests/type_funcall/fib.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/fib.e.expect_1_2_3 create mode 100644 tests/type_funcall/fib.e.expect_lexer create mode 100644 tests/type_funcall/gcdrec.e create mode 100644 tests/type_funcall/gcdrec.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/gcdrec.e.expect_1_2_3 create mode 100644 tests/type_funcall/gcdrec.e.expect_lexer create mode 100644 tests/type_funcall/hanoi.e create mode 100644 tests/type_funcall/hanoi.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/hanoi.e.expect_1_2_3 create mode 100644 tests/type_funcall/hanoi.e.expect_lexer create mode 100644 tests/type_funcall/lots_of_args.e create mode 100644 tests/type_funcall/lots_of_args.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/lots_of_args.e.expect_1_2_3 create mode 100644 tests/type_funcall/lots_of_args.e.expect_lexer create mode 100644 tests/type_funcall/mutrec-hofstadter.e create mode 100644 tests/type_funcall/mutrec-hofstadter.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/mutrec-hofstadter.e.expect_1_2_3 create mode 100644 tests/type_funcall/mutrec-hofstadter.e.expect_lexer create mode 100644 tests/type_funcall/mutrec.e create mode 100644 tests/type_funcall/mutrec.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/mutrec.e.expect_1_2_3 create mode 100644 tests/type_funcall/mutrec.e.expect_lexer create mode 100644 tests/type_funcall/print_and_fun.e create mode 100644 tests/type_funcall/print_and_fun.e.expect_14_12_3_8_12 create mode 100644 tests/type_funcall/print_and_fun.e.expect_1_2_3 create mode 100644 tests/type_funcall/print_and_fun.e.expect_lexer diff --git a/tests/char/char.e b/tests/char/char.e index c671744..f52c227 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 0000000..aaa03ba --- /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 0000000..aaa03ba --- /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 0000000..770eef3 --- /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 0000000..0b8dba5 --- /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 0000000..d290572 --- /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 0000000..d290572 --- /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 0000000..60571b6 --- /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 fd90c93..a033bb7 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 0000000..f0c44f5 --- /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 0000000..f0c44f5 --- /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 0000000..71a8f58 --- /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 0000000..d246ea7 --- /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 0000000..91ce1a2 --- /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 0000000..ff173ec --- /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 0000000..b46c584 --- /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 0000000..de75cc8 --- /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 0000000..da50e81 --- /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 0000000..91ce1a2 --- /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 0000000..aee5846 --- /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 0000000..f458d82 --- /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 0000000..1cd05b5 --- /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 0000000..da50e81 --- /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 0000000..25d1713 --- /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 0000000..bcf5a34 --- /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 0000000..91ce1a2 --- /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 0000000..91ce1a2 --- /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 0000000..acf4460 --- /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 0000000..6b87138 --- /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 0000000..41cdc33 --- /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 0000000..41cdc33 --- /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 0000000..3645835 --- /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 0000000..3c286ec --- /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 0000000..810d9ab --- /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 0000000..810d9ab --- /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 0000000..4e1e267 --- /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 0000000..84af816 --- /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 0000000..4de51e4 --- /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 0000000..b55e8e2 --- /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 0000000..04fa61b --- /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 0000000..c811dfb --- /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 0000000..810d9ab --- /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 0000000..810d9ab --- /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 0000000..da07d6c --- /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 0000000..d89e897 --- /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 0000000..fde1f63 --- /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 0000000..42f3b7b --- /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 0000000..9996cf6 --- /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 0000000..0b58875 --- /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 0000000..42f3b7b --- /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 0000000..42f3b7b --- /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 0000000..88da258 --- /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 0000000..9cec46b --- /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 0000000..e9f03bd --- /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 0000000..df1c5a5 --- /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 0000000..a237aec --- /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 0000000..2b1761e --- /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 0000000..fa26d1e --- /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 0000000..91ce1a2 --- /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 0000000..03f393a --- /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 0000000..b66019c --- /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 0000000..1fef237 --- /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 0000000..91ce1a2 --- /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 0000000..d3a339b --- /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 0000000..10c5b2b --- /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 0000000..df1c5a5 --- /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 0000000..91ce1a2 --- /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 0000000..202f2a3 --- /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 0000000..c7efc4f --- /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 0000000..016d6cd --- /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 0000000..016d6cd --- /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 0000000..d50f0b7 --- /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 0000000..dd56369 --- /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 0000000..556b004 --- /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 0000000..919b014 --- /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 0000000..919b014 --- /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 0000000..01dbf81 --- /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 0000000..0f452a3 --- /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 0000000..42f3b7b --- /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 0000000..42f3b7b --- /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 0000000..7bf5b40 --- /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 0000000..25756bb --- /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 0000000..feb4775 --- /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 0000000..feb4775 --- /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 0000000..4be870b --- /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 0000000..bcfb12e --- /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 0000000..4c5f671 --- /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 0000000..4c5f671 --- /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 0000000..d11120d --- /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 0000000..5180cb5 --- /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 0000000..36bc30a --- /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 0000000..0f7c0dd --- /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 0000000..da9931e --- /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 0000000..ae50329 --- /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 0000000..61b83a8 --- /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 0000000..61b83a8 --- /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 0000000..59eca12 --- /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 0000000..35404b0 --- /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 0000000..6bca380 --- /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 0000000..6bca380 --- /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 0000000..6be78df --- /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 0000000..03bb55f --- /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 0000000..372d540 --- /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 0000000..eb1504d --- /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 0000000..8308731 --- /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 0000000..5f1554b --- /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 0000000..5867cb8 --- /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 0000000..5867cb8 --- /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 0000000..07ba560 --- /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 0000000..1f05dd1 --- /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 0000000..b55e8e2 --- /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 0000000..91ce1a2 --- /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 0000000..1781dd9 --- /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 0000000..5c1dba6 --- /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 0000000..42f3b7b --- /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 0000000..42f3b7b --- /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 0000000..43125c4 --- /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 0000000..1d20be4 --- /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 0000000..42f3b7b --- /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 0000000..42f3b7b --- /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 0000000..60561b3 --- /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 0000000..ae36a90 --- /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 0000000..4de51e4 --- /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 0000000..4de51e4 --- /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 0000000..d659c80 --- /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 0000000..f10a326 --- /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 0000000..43b8874 --- /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 0000000..43b8874 --- /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 0000000..aeca8d5 --- /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 0000000..2608144 --- /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 0000000..51f9f22 --- /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 0000000..51f9f22 --- /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 0000000..014cbc8 --- /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 0000000..80f9760 --- /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 0000000..3bb7e49 --- /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 0000000..3bb7e49 --- /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 0000000..d2420ab --- /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 0000000..dd9da5f --- /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 0000000..a08d971 --- /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 0000000..91ce1a2 --- /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 0000000..df81683 --- /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 0000000..bcda785 --- /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 0000000..877f0e9 --- /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 0000000..97ad20e --- /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 0000000..e8d7ade --- /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 0000000..d1a92cf --- /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 0000000..acdae70 --- /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 0000000..26ac483 --- /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 0000000..49a279e --- /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 0000000..6664018 --- /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 0000000..239dfef --- /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 0000000..83e427f --- /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 0000000..9804039 --- /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 0000000..97f78d3 --- /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 0000000..fdcca39 --- /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 0000000..fdcca39 --- /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 0000000..29c2bad --- /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 0000000..27e8a87 --- /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 0000000..91ce1a2 --- /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 0000000..91ce1a2 --- /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 0000000..09ba8e3 --- /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 0000000..7074917 --- /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 0000000..fd86695 --- /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 0000000..7734d64 --- /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 0000000..0334e56 --- /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 0000000..0334e56 --- /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 0000000..6ec0d9a --- /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 0000000..47c1bbb --- /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 0000000..e2ce800 --- /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 0000000..e2ce800 --- /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 0000000..5031f54 --- /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 0000000..52154e2 --- /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 0000000..e9a8021 --- /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 0000000..61b83a8 --- /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 0000000..e148e3b --- /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 0000000..00b8178 --- /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 0000000..38f595a --- /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 0000000..e03517f --- /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 0000000..0132421 --- /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 0000000..8a9c1fe --- /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 0000000..1705ac5 --- /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 0000000..1705ac5 --- /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 0000000..82bef8a --- /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 0000000..8a6f91b --- /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 0000000..c24e9b8 --- /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 0000000..c24e9b8 --- /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 0000000..cdb1ed6 --- /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 0000000..8dc310f --- /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 0000000..ff173ec --- /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 0000000..ff173ec --- /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 0000000..642da6e --- /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 0000000..fd6aa2e --- /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 0000000..1fef237 --- /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 0000000..91ce1a2 --- /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 0000000..700aacb --- /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 0000000..2eef179 --- /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 0000000..df1c5a5 --- /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 0000000..91ce1a2 --- /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 0000000..7b5f13a --- /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 0000000..c6edfbc --- /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 0000000..7cf52b9 --- /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 0000000..91ce1a2 --- /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 0000000..ca101e6 --- /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 0000000..a03f341 --- /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 0000000..16d63e1 --- /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 0000000..16d63e1 --- /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 0000000..e9ed44e --- /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 0000000..7e47625 --- /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 0000000..123726a --- /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 0000000..eb1504d --- /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 0000000..1e95da5 --- /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 0000000..6e5cb31 --- /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 0000000..c5e79f7 --- /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 0000000..b856e34 --- /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 0000000..c288508 --- /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 0000000..4e58317 --- /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 0000000..7d935d7 --- /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 0000000..7d935d7 --- /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 0000000..5c3dd6a --- /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 -- GitLab