Settings

Theme

Show HN: Made a simple parser/evaluator of arithmetic expressions in Python

github.com

1 points by beyonddream 3 years ago · 0 comments · 1 min read

Reader

I was noodling around with Python on a boring evening, when I decided to try my hand at writing a hand rolled arithmetic expression parser/evaluator without using any parsing tools/generators. I made this repo purely for educational/fun purpose since it only supports 4 basic arithmetic operators and nested sub-expressions (to make it slightly more challenging :P).

Then I had the idea to extend the unit tests with Hypothesis (Python's property based unit testing library) and it found an edge case in my simple implementation that I thought had it covered via unit tests!

Sharing this repo just in case anyone finds it interesting (esp. the hypothesis test file.)

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection