I recommend Instaparse (https://github.com/Engelberg/instaparse) for all of your parsing needs.
On Monday, September 21, 2015 at 12:29:16 PM UTC-4, Vitaliy Vlasov wrote: > > Hi all, > > I'm happy to write my first post here:) I am writing a mathematical > formula parser in Clojure. The formulas need to be written in infix > notation and also support some primitive conditional statements (e.g. > if-else and case), so that for instance this string would be parsed into a > valid Clojure function definition: > > if cond-value1 > v1 * v2 - v3 > else > v4 ** 2 > > The infix part turned out to be very easy thanks to Incanter's infix > module (i use eval and Incanters' $=). So right now the system supports > formulas without conditionals. > > But I'm not sure on how to proceed with the conditional statements parser. > Does a generalised approach/library exist on how to approach these kinds of > problems? If not, i will implement my own of course. > > Thank you! > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.