-
Notifications
You must be signed in to change notification settings - Fork 32
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
what function to call for parsing string expressions #83
Comments
I'm not sure what you're asking. Are you wanting a library that can parse |
Understood, so I can not do some Where can I find the current logic of the CLI? Maybe I can do something with that. |
You are correct. However, what is easiest depends on what you are trying to do. Do you need the full If you need the full language, the best solution would be to run If you need simple expression parsing, then you could implement the parsing with Lex and Yacc, and then use If you need something else, we can see what might work best. |
Just basic calculations like
Unfortunately this brings much overhead, I already tested that with
This sounds more like what I am looking for, even though I wanted to avoid Yacc. |
While refactoring to bring the full Do you just need the four basic arithmetic operators? Do you need parentheses? Do you need square root? Let me know what you need. I may need a week to get it to you. |
I will check that and let you know in the next days. At least parentheses are also needed. If there is at least one function (like sqrt or max) implemened, then I can check the implementation and contribute some of my time to implement more or at least I can help with that. |
You can see everything that's builtin here. |
Ack! I'm sorry! I just had something come up in my personal life that will take a lot of time to resolve! So despite hoping to help with the parsing, I can't even help with a simple thing anymore. However, I can point you in the right direction. Use the Shunting-Yard Algorithm like this to make an abstract syntax tree, and then do a post-order traversal. If you need examples of how to use Again, I'm really sorry about this, but I figured it would be better to tell you sooner rather than later. |
No problem and thanks for letting me know. I will try to understand and solve it. |
I'm new to C and I try to create a PHP extension of bc with SWIG, but as direct replacement for
eval()
in PHP.What is the correct function from the bc code to parse a string and return the calculation result or some error / null when parsing fails?
I tried looking at the code, but didn't find the right one.
The text was updated successfully, but these errors were encountered: