Coder Social home page Coder Social logo

Comments (6)

codingseb avatar codingseb commented on September 24, 2024

Ok. I need to think a little about this one.
I didn't provide that somebody want to change operators.

I will also check if operators like or and are not in conflict with the way it parse and evaluate variables.

from expressionevaluator.

kasajian avatar kasajian commented on September 24, 2024

I guess I am making the assumption that this evaluator is meant to allow one to tweak the syntax depending on need. But Maybe that's wrong and this is really supposed to be primarily a C# syntax evaluator.

I need an evaluator that has a preexisting defined syntax -- and it's a combination of BASIC and C where you have both && and 'and', || and 'or', also both "=" and "==" work. There's no assignments -- just expressions.

So I think there's a decision to be made here. Decide that this code-base is not fit-for-purpose for my needs, Or, put the code-base on a path such that some of these things are user-extensible. For instance, perhaps some future version of the library can allow for the above mentioned changes be configured dynamically rather than change the source.

from expressionevaluator.

codingseb avatar codingseb commented on September 24, 2024

Yes. A goal of this evaluator is to be as near as possible of C# by default.

But you can of course try to adapt it to your need if it works.

I think modify existing operators is quite easy but you need to modify ExpressionEvaluator file itself as you say. If a way to modify or extend how operators work from outside of the file could exists it would be better. It could be also easier to update the library. So I will think about it for future versions.

At first EvaluationExpression was just a small thing that I made for my own needs. I just decided at some point to share it so it can maybe help others. I appreciate ideas like yours because it help this project to live. It's just that I didn't think about this specific idea until now.
So it will probably take some time until something fully extensible will be available.
And it will also probably need some deeper changes and refactoring of the lib.

from expressionevaluator.

codingseb avatar codingseb commented on September 24, 2024

Just to keep track of some ideas related to it :

  • Add a way to allow aliases for existing operators like Or, And
  • Add a way to add some custom operators and corresponding implementations
  • Flexible length of the operators
  • Types : multiple operands vs Single operands (Maybe start with only 2 operands operators)
  • Take care of operators precedences (priorities)

Examples :

x love y;
a kill b;
Not v;
~?variable;
c @+ h;
a @ b # c;
//...

from expressionevaluator.

kasajian avatar kasajian commented on September 24, 2024

Yes, very cool. I also like the fact that it's all in one file. thanks.

from expressionevaluator.

codingseb avatar codingseb commented on September 24, 2024

OK I think the new release 1.4.0.0 resolve this issue. See this for more infos

it took some time, but it's here.

from expressionevaluator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.