-
Notifications
You must be signed in to change notification settings - Fork 164
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
Intial Implementation for SymbolicExpression ttype #1846
Conversation
See also #1591. |
You must resolve conflicts so that the CI tests run. |
I think you have to update reference results with |
Hello @certik . I've got the C code generated for a simple assignment program . Like the following
It looks like the following
where |
Yes, that looks good. As we discussed, I would "inline" the |
Yes . I will address that in the following commit (just refining the code). Currently I have the following
|
Make sure you enable |
Very good, excellent progress! I think now we just need to print it, so that we can see some result when we compile this. |
Yes, I have been generating C code , then taking the Also my latest commit adds functionality for supporting symbolic constants , for now I've added
The C code we generate for this looks like
It gives me |
Here is the first test: from sympy import Symbol, pi
from lpython import S
def main0():
x: S = Symbol('x')
y: S = Symbol('y')
x = pi
z: S = x + y
print(z)
main0() TODO:
|
Overall I think this PR looks pretty good. If @Shaikh-Ubaid is fine with it, I'll give it a thorough review and testing tomorrow and we can then merge it. |
I do see some improvements which should be introduced in |
@anutosh491 Please make a note of changes we discussed to be tackled later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Thank you so much for this @anutosh491 !
Yes , I've made a note of the things that have been pointed out by you and @Thirumalai-Shaktivel . I'll address them in the upcoming Prs. |
Also another minor point, it seems
or S: Student // where Student is some class defined It seems to (easily) conflict with the |
We actually stuck to
So But I get the fact that this is a bit vulnerable as shown by your examples above ! |
We need to eventually allow renaming, like I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed by hand as much as I could. I think everything works!
Great job @anutosh491, this was the hardest. This provides the infrastructure and from here things should go a lot easier. Thank you @Shaikh-Ubaid for your review and help. Thanks @Thirumalai-Shaktivel for your great help with this. @anutosh491 I would say from here, the next step is to add more symbolic features. Just add new tests and let's start supporting all the arithmetic operations, functions like sin/cos, operations like limit, integrate, diff, series, etc. Just use the C backend and the existing CI setup. As you start adding things, we'll have to iterate on the ASR design as needed. We'll have to eventually figure out how to free things correctly ( After we have a reasonable subset working, then we'll tackle the LLVM backend and get all the symbolic tests working with LLVM also. |
Thanks a lot everyone who guided me on the PR . I'll send the second PR by today ! |
Through this Pr , I would like to solve a basic program involving symbolic expressions , which is
This essentially involves few steps
SymbolicExpression
ttypeSymbolicSymbol
as an intrinsic functionCurrently I've tried to address the 2nd and 3rd step !