stefanobaghino / lox-interpreter

Interpreter for Lox (https://craftinginterpreters.com) written in Go
0 stars 0 forks source link

Handle divisions by zero explicitly #50

Closed stefanobaghino closed 6 months ago

stefanobaghino commented 1 year ago

What happens right now if you divide a number by zero? What do you think should happen? Justify your choice. How do other languages you know handle division by zero, and why do they make the choices they do?

Change the implementation in visitBinaryExpr() to detect and report a runtime error for this case.

-- https://craftinginterpreters.com/evaluating-expressions.html