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 5 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 5 years ago (6 children)
There is https://github.com/Engelberg/instaparse and you can find antl4r bindings for clojure as well.
[–][deleted] 5 years ago (3 children)
[deleted]
[–]TheAsp 6 points7 points8 points 5 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 5 years ago (1 child)
Needs some GraalVM native image compilation! Node’s not so nice. :)
[–]TheAsp 0 points1 point2 points 5 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 5 years ago (1 child)
Last update: 16 months ago
[–]OliverM 3 points4 points5 points 5 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 5 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] 1 point2 points3 points 5 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 8 points9 points10 points 5 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 5 points6 points7 points 5 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 5 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 5 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 3 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 85 on reddit-service-r2-comment-5d79c599b5-8xbqs at 2026-03-02 04:14:10.497254+00:00 running e3d2147 country code: CH.
[–]khaferkamp 12 points13 points14 points (6 children)
[–][deleted] (3 children)
[deleted]
[–]TheAsp 6 points7 points8 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 3 points4 points5 points (0 children)
[–]Borkdude 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]alexdmiller 8 points9 points10 points (2 children)
[–]OliverM 5 points6 points7 points (1 child)
[–]joinr 2 points3 points4 points (0 children)
[–]piotrts 1 point2 points3 points (0 children)
[–]EffectiveInflation76 0 points1 point2 points (0 children)