This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-21
Channels
- # admin-announcements (24)
- # beginners (80)
- # cider (18)
- # cljs-dev (12)
- # clojure (94)
- # clojure-berlin (15)
- # clojure-dev (10)
- # clojure-gamedev (3)
- # clojure-italy (38)
- # clojure-japan (4)
- # clojure-russia (109)
- # clojure-sg (1)
- # clojurescript (161)
- # code-reviews (29)
- # core-async (17)
- # datomic (20)
- # editors (14)
- # instaparse (17)
- # ldnclj (9)
- # off-topic (9)
- # om (2)
- # onyx (2)
- # re-frame (11)
- # reagent (46)
What are some approaches you guys use to interpret your parse tree?
or heck, just use https://clojure.github.io/clojure/clojure.walk-api.html
depends on how you want to eval, it’s a wee bit harder for compilation, but not much. You just need to make sure you emit a string. One solution would be to treat it as a side effect of whatever function you use
admittedly, when I last did this I wasn’t using an instaparse’d parse tree, so maybe the technique varies a bit
@marcofiset insta/transform
has always been sufficient for my use cases. Is there more sophisticated functionality you're looking for? If so, clojure.walk/[pre|post]walk
might be the next step up.
I am not looking for anything particular, just wanted to start a discussion on the subject. I'm using multi methods for the moment and I was curious about what other people might be using.
I didn't know about insta/transform, I'll definitely take a look.
Yeah, instaparse.core/transform
is a simple function that does the trick for simple parse tree consumption.
Hey, that rhymes
@marcofiset Take a look at this section of the readme: https://github.com/engelberg/instaparse#transforming-the-tree
Wow, I'm really impressed with the arithmetic example! Very straightforward and simple. My multi methods solution is going to the trash and will be replaced by something similar 😃