DescriptionThis project adds support in Clojure for Parsing Expression Grammars. In addition to the basic operators I've added tracking AST branches, referring to tracked branches, gathering simple repetitions, and specifying a repetition count. While the current version allows for expanding the types of supported input to anything you'd like, future releases will include an input wrapper to process binary structures.
Claim to fameThis...
Expr <- [Sum $] Sum <- [Product (* [SumOp Product])] Product <- [Value (* [ProductOp Value])] Value <- (| Num Sum) Num <- JSONNumber ; Referencing a Non-Terminal from a JSON PEG SumOp <- #"^[+-]" ProductOp <- #"^[*/]"
... turns into a parser with only a few extra lines of code (three more small lines would be comfortable). The grammar reads quite easily as well. The production for the non-terminal Sum could be read:
A Product followed by zero-or-more of the SumOp Product pair
UseThe User Manual will bring you up to speed quicklyit's a light three pages including code samples.
LicenseThis project has been released under the EPL 1.0 license.