elikaski / BF-it

A C-like language to Brainfuck compiler, written in Python
MIT License
120 stars 11 forks source link

Omit Division by 0 Error check, if the divisor is known #41

Closed NeeEoo closed 3 years ago

NeeEoo commented 3 years ago

Closes #11

elikaski commented 3 years ago

Because this change works only for trivial cases where you have in the code <something> / 0 or <something> % 0 I think it would be better to stop the compilation and display a proper error message, rather than compiling, running, and then have the runtime division error guaranteed to be executed

NeeEoo commented 3 years ago

Would a warning be better? Or should i make it so that it raises an ZeroDivisionError

elikaski commented 3 years ago

Your decision :) I think it should raise an exception (BFSemanticError) and stop

elikaski commented 3 years ago

Merged, thank you!

NeeEoo commented 3 years ago

Just wondering did you squash my commits? Since I made 2 commits but there is only 1 listed.

elikaski commented 3 years ago

Yes, I did I don't want many commits for one issue :)

NeeEoo commented 3 years ago

Ah okay. Was also confused why it said that my commit was verified with a key, but that key belongs to GitHub so no worries.