[BUG REPORT] Print error message: A case where the the check_if will always overflow
Math-O5 opened this issue · 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
Yeah currently it just expects something to be there, there should be an index out of range check too in check_if.
Passing the index as argument and processing check_if only if the index is in range will fix this.
I would like to work on this @frankhart2018.
@jigyasudhingra All yours. :)
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.
Do you want to work in this @ami-harry
@frankhart2018 yes. I want to work
Sure assigning this to you too @ami-harry.