Hi. I was bored, so I made an expression parser in Java, for evaluating Strings like "sin(3+4*2/(1-5)^2^3)" as mathematical expressions. Usage: Code: String exp = "sin(3+4*2/(1-5)^2^3)"; ExpressionParser parser = new ExpressionParser(exp); System.out.println(parser.evaluate()); This uses the Shunting Yard Algorithm (https://en.wikipedia.org/wiki/Shunting-yard_algorithm). GitHub: https://github.com/MCMastery/expression-parser You could use this for user-given calculations. Probably not that useful, but I've seen many questions about how to evaluate expressions in Java elsewhere. Thanks for reading ,_,
@MCMastery Looks nice! And a lot better than the recursive one I made some time ago And better than anything I could come up with Still wonder why people name Interfaces "Ixxx" though. Any special reason? Shouldn't an IDE format them accordingly? Maybe not that useful, I rarely found the need to evaluate an expression myself (and you could use the Rhino engine. If you want to backstab performance and security... Critical.), but I still find it useful to see how other, better, people solve this problem. Will try to recreate this, and then compare it to yours. And then probably change it by a ton, to closer resemble what you did So thank you, random person from the internet
aw man i was working on this but you beat me. I know why you are doing this ^w^ Message me so we can do more work! @MCMastery I might not be on as much as expected- Im on a hotel computer