New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement parsing of expressions #559
Comments
@certik , have researched into this, and will begin working. I wanted to know how symbols will be represented? Will a user be made to enter Another thing was dealing with double values entered. ( |
@isuruf @Sumith1896 Thoughts? I've already got a basic version running, and need to know specifics to proceed. |
For double |
This needs thought on how to provide a parser to users of symengine, at all. I mean you don't change parsers within SymPy sessions either. Or is it thought purely for symengine devs to write tests? |
@rwst, what do you mean by
|
Usually SymEngine is loaded manually onto an existing SymPy session. At this time the original parser is already active and symbols may exist. |
Even if symbols exist, there should be no problem right? |
What if in SymPy:
Wouldn't there be a problem? The new parser would take |
You are right. That will have to be considered. For the use case though it's not really a problem as it is more of a serialize/deserialize problem. |
@rwst, it seems SymPy doesn't do that either.
|
@srajangarg as the first iteration, treat every name as a symbol, unless it is a known function. I assume we can design it so that the user can customize the list of functions. So if it is a number, let's do integers and rationals only for now, then it just returns I would not try to parse code like Let me know if you have any other questions. |
Fixed via #772 |
We'll eventually need to implement a fast parser of expressions like: https://github.com/sympy/symengine/blob/8dd550ba20c0a13fb5a3e34c197c10bfaf79ae8d/benchmarks/expr.txt
Probably the easiest and most robust is to implement our own parser, I don't think it's very difficult, since it is just parsing of expressions. Here is one tutorial that I found (there are many out there): http://www.strchr.com/expression_evaluator, we just need to replace the return type
double
withRCP<const Basic>
, and add support for functions and symbols. I think that's it.(The main motivation is that SymPy takes a long time to sympify this long expression.)
The text was updated successfully, but these errors were encountered: