orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.84k stars 392 forks source link

Doesn't properly handle a single negative number as the input in `evaluation.c` #174

Open guacs opened 1 year ago

guacs commented 1 year ago

In the resulting evaluation.c of Chapter 7, the input of -5 would be evaluated to 5 instead of the expected -5. This is because the op is only evaluated within the while loop but in cases where there are no expr children, the loop is never entered.