calkt icon indicating copy to clipboard operation
calkt copied to clipboard

Boolean Evaluator - support

Open Woren opened this issue 1 year ago • 3 comments

Add support for boolean expression parsing and evaluation. For example expression ( 0 == 1 && -10 > 11 ) || ( 10 <= 9 ) && ( -1.0 == 1.7 ) will return true/false It would be nice to have support also for expressions without numbers like (!true || false) || (false)

There is for example this stackoverflow post which is about this topic if it can be any help. https://stackoverflow.com/questions/62218073/how-can-we-evaluate-a-boolean-expression-represented-by-a-string-in-kotlin This example is in many ways limited. No support for negative or float numbers parsing, no <=, >= handling etc.

Why is this important? Be able to parse (simple) 3rd party scripting languages into kotlin code and execute them.

Thanks for considering supporting this!

Woren avatar Aug 20 '24 14:08 Woren

This seems pretty reasonable to support. I will add this to ideas list that I wish to implement and as soon I have time to work on the project I will implement this. But first, I need to support function calls (line sin, cos)

y9san9 avatar Aug 20 '24 17:08 y9san9

This would probably be in a separate module like ":bool"

y9san9 avatar Aug 20 '24 17:08 y9san9

Great, nice to hear it. I really appreciate it.

Woren avatar Aug 20 '24 17:08 Woren