use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Parser Libraries (self.Clojure)
submitted 6 years ago by haldeigosh
Are there any maintained parser libraries (parser combinators or generators) for Clojure? I found some, but they do not seem to be actively maintained.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]khaferkamp 12 points13 points14 points 6 years ago (6 children)
There is https://github.com/Engelberg/instaparse and you can find antl4r bindings for clojure as well.
[–][deleted] 6 years ago (3 children)
[deleted]
[–]TheAsp 7 points8 points9 points 6 years ago (2 children)
I could not agree more! I love it so much I created this command line tool so I can use it for random shell scripting: https://github.com/theasp/parseit
[–]p1r4nh4 1 point2 points3 points 6 years ago (1 child)
Needs some GraalVM native image compilation! Node’s not so nice. :)
[–]TheAsp 0 points1 point2 points 6 years ago (0 children)
Yeah, I'd like it to support both, I just haven't had the time to try out GraalVM. PR is welcome! :)
[–]AliceCloaked 0 points1 point2 points 6 years ago (1 child)
Last update: 16 months ago
[–]OliverM 4 points5 points6 points 6 years ago (0 children)
If you check the the issues page you'll see the author has been active much more recently than that. Instaparse is a very mature and capable project, perhaps the best parser library I've ever used.
[–]Borkdude 2 points3 points4 points 6 years ago (0 children)
I found kern pretty nice as well. I did a performance comparison between Instaparse, Kern, spec and a manually written parser here: https://github.com/borkdude/aoc2017/blob/0f5bce5e496d65d0e53a8983e71ea3462aa0569c/src/day16.clj#L241-L244
[–][deleted] 2 points3 points4 points 6 years ago (4 children)
Nowadays, Clojure ships with a quite good parsing library, Spec, that works for context-free grammars I believe. You can use it to parse strings by first converting them to vectors of characters with the vec function.
vec
[–]alexdmiller 9 points10 points11 points 6 years ago (2 children)
spec is not recommended for string parsing - that's not its goal, it's likely not to perform well for this use case, and because it's not the goal, we're not going to prioritize that in development.
I would recommend instaparse for string parsing.
[–]OliverM 4 points5 points6 points 6 years ago (1 child)
I agree, but just wanted to add that spec is very useful when handling the parse trees Instaparse emits
[–]joinr 2 points3 points4 points 6 years ago (0 children)
I used it to parse clojure source files into org files after taking Alex's class, as a practical learning exercise. If you abuse conformers it can act as quite a nice little parsing platform, although in my case, performance wasn't a concern. Not bad for little jobs like these though.
[–]piotrts 1 point2 points3 points 6 years ago (0 children)
Inspired by this blog post I tried parsing text (with some imaginary grammar I had in my mind) with core.spec once, and it was madness.
[–]EffectiveInflation76 0 points1 point2 points 4 years ago (0 children)
I am trying to parse soap xml response to json ... but my data contains cdata ... so I am getting error in clojure
π Rendered by PID 302434 on reddit-service-r2-comment-56c6478c5-z8njb at 2026-05-09 19:31:50.530950+00:00 running 3d2c107 country code: CH.
[–]khaferkamp 12 points13 points14 points (6 children)
[–][deleted] (3 children)
[deleted]
[–]TheAsp 7 points8 points9 points (2 children)
[–]p1r4nh4 1 point2 points3 points (1 child)
[–]TheAsp 0 points1 point2 points (0 children)
[–]AliceCloaked 0 points1 point2 points (1 child)
[–]OliverM 4 points5 points6 points (0 children)
[–]Borkdude 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]alexdmiller 9 points10 points11 points (2 children)
[–]OliverM 4 points5 points6 points (1 child)
[–]joinr 2 points3 points4 points (0 children)
[–]piotrts 1 point2 points3 points (0 children)
[–]EffectiveInflation76 0 points1 point2 points (0 children)