DDMathParser
DDMathParser copied to clipboard
Pure left-to-right evaluation
How to make + − the same precedence as x ÷ ?
Such that 3+5x2=13 becomes 3+5x2=16
Well, you could edit the code in _DDMathOperatorInfo.m to make the operators have the same precedence, but that would only get you half-way there. What you're really asking for is for things to be always evaluated left-to-right, regardless of precedence. That would require significant work. However, I recognize that when it comes to writing a calculator app, left-to-right evaluation often feels "more natural", so I'll see if I can get around to doing this.
This could be accomplished by writing a custom Expressionizer (the thing that turns GroupedTokens into Expressions).
I'm looking to be able to toggle precedence at runtime. Could you provide an example (or link) to how this would be done using a custom Expressionizer (in Objective-C)?
Hi Dave. Just wondering if you've gotten a chance to add this (to the Obj-C version)?
I've been evaluating the Swift (3) branch recently. Any movement on this there (I assume you're no longer updating Obj-C as actively)?
@davedelong Hey Dave. Getting back on my project and hoping this is still in the cards?