Keval – A mini lib for mathematical expression evaluation

Hey guys ! I recently finished and released a “major” version in my library, so I thought I’d share it with you.

Here’s the Github repo for Keval

It’s a very simple library in use, and works well with all JVM languages.

Since .eval() is only available in Kotlin/JS, I thought I’d make one just for fun.

As said in the README of the repo, this is to be used in full knowledge that it is usually a big code smell if you need to evaluate a string. The only valid use case I can think of is when making a graphical calculator (as in, without buttons) in an app. But it’s been quite a neat project so far.

It also has custom Exceptions, so that you can use them to know what and where an error might have occurred (missing parenthesis, missing operand, unknown operator, zero division)

I plan on adding features such as support for operators other than binary, constants, and custom operators from the user.

If you have advises, I’ll gladly take them !

submitted by /u/n0tKamui
[link] [comments]