sim-c icon indicating copy to clipboard operation
sim-c copied to clipboard

[BUG REPORT] Print error message: A case where the the check_if will always overflow

Open Math-O5 opened this issue 3 years ago • 8 comments

Describe the bug When user type incomplete programs, the "check_if(tokens[i + 1])" in sim/simc_parse.py will always overflow, if there is not tokens[i + 1].

The program typed by the use is clearly wrong, but the program should treat this properly.

To Reproduce Complie this simc code:

test.simc:

MAIN
    if()
MAIN
    var
MAIN
    f
MAIN
    array overflow

Ouput error:

...
  File "/home/math-o5/anaconda3/lib/python3.7/site-packages/simc/simc_parser.py", line 673, in check_ptr
    if tokens[i].type == "multiply":
IndexError: list index out of range

Expected behavior A kind message error for user

Desktop (please complete the following information):

  • OS: Fedora 30, Ubuntu 18

Math-O5 avatar Dec 07 '20 16:12 Math-O5

Yeah currently it just expects something to be there, there should be an index out of range check too in check_if.

frankhart2018 avatar Dec 07 '20 17:12 frankhart2018

Passing the index as argument and processing check_if only if the index is in range will fix this.

frankhart2018 avatar Dec 07 '20 17:12 frankhart2018

I would like to work on this @frankhart2018.

jigyasudhingra avatar Dec 09 '20 11:12 jigyasudhingra

@jigyasudhingra All yours. :)

Math-O5 avatar Dec 09 '20 14:12 Math-O5

your list is empty and you are trying to compare its index type, but your list is empty so that it is giving the output like that.

imHarry404 avatar Dec 28 '20 16:12 imHarry404

Do you want to work in this @ami-harry

frankhart2018 avatar Dec 28 '20 16:12 frankhart2018

@frankhart2018 yes. I want to work

imHarry404 avatar Dec 28 '20 16:12 imHarry404

Sure assigning this to you too @ami-harry.

frankhart2018 avatar Dec 28 '20 16:12 frankhart2018