yds12 / mexe

Simple and fast arithmetic expression parser
MIT License
8 stars 0 forks source link

Add a `check` function #17

Open yds12 opened 2 years ago

yds12 commented 2 years ago

This function would receive an expression and return a boolean indicating whether the expression is valid.

The use case for this is that it should be significantly faster than eval since we don't have to evaluate anything. In particular, we wouldn't need to call parse which is the slowest part of eval.

We can try to use something like the Mode pattern described here to avoid code duplication between eval and check.