Instaparse is an easy-to-use, feature-rich parser generator for Clojure.
The two stand-out features:
1. Converts standard EBNF notation for context-free grammars into an
executable parser. Makes the task of building parsers as lightweight and
simple as working with regular expressions.
2. Works with *any* context-free grammar. This means you don't have to
learn the esoteric subtleties of LR, LL, LALR or any other specialized
subset. Left-recursion, right-recursion, ambiguous grammars -- instaparse
handles it all.
Example:
(def as-and-bs
(parser
"S = AB*
AB = A B
A = 'a'+
B = 'b'+"))
=> (as-and-bs "aaaaabbbaaaabb")
[:S
[:AB [:A "a" "a" "a" "a" "a"] [:B "b" "b" "b"]]
[:AB [:A "a" "a" "a" "a"] [:B "b" "b"]]]
https://github.com/Engelberg/instaparse for full feature list and extensive
tutorial.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.