-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Use LR parser to parse expressions coming from the Clipboard and generate commands #344
Comments
This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it. |
Thanks for digging into this, Rudy! Even though this would seem to fix a number of bugs we have been seeing reported, as you point out, since it seems to fundamentally change how we handle pasted input, I am going to track it as a feature. Let's leave this proposal open for discussion. While not directly related, we are also investigating MathML input (#72) and rendering (#71). If we overhaul our lexing/parsing approach, I think it is worth considering options that may support those efforts as well. |
I don't suppose we can include
|
It's alread managed by my prototype: 3^8 in Scientific mode: 3 power 8 |
This issue is a sub-task of the other one, you can close it. Is anyone working on #526? |
Great, closing this one down. No one is actively working on the speci'ing of #526 at the moment. If you're interested, just drop your name in over there and @grochocki should be able to get you a working branch in https://github.com/Microsoft/calculator-specs. |
The current code to manage the clipboard only supports a subset of functions managed by the calculator, has some issues to parse them (many false positives or issues with locales due to the conversion to en-us format but ignoring that '.' and ',' can be used for other purposes in the original locale) and very complicated to maintain/add new features (sin, pin, square, etc..).
In order to simplify and make this function more robust, we should instead use a language parser, more suited to our needs.
My proposal would be to use a custom Lexer to support all the different number formats (hex, bin, dec, bin, dec with exponent, ...) and modes (standard, programmer, etc...) we support and use a LR parser to verify and generate the list of commands. This solution would have many advantages:
In my proto-PR, I used Bison, a GPL v3 tool but providing an explicit exception to allow the use of the generated code without license.
It already manages a variety of features not currently available:
sinus/cos/tan
** Power, square, cube ** (#299)
more sign operators
Binary operations: OR, NOT, AND, XOR
and fix some reported bugs:
Proto-PR available here
https://github.com/rudyhuyn/calculator/tree/AddExpressionParser
remaining:
The text was updated successfully, but these errors were encountered: