Unlike PEG oriented libraries, Moony Parser exhibits its own "Structured BNF" grammar definition language that is more readable and compact than PEG grammars. Moony Parser is also context free grammar (CFG) complete which means that it supports a larger set of definable grammars than PEG grammars. As a compensation for CFG completeness, Moony Parser operates on a lower speed performance than PEG parsers.
Comparison of Structured BNF grammar definition vs. PEG grammar definition:
Structured BNF grammar example
PEG grammar example
Integer (/[0-9]+/) |
Bra (Left ('('), In (@Sum), Right (')'))
MulDiv (Left (@Fact), In ('*' | '/'), Right (@Exp))
AddSub (Left (@Sum), In ('+' | '-'), Right (@Fact))
= left:Fact ("+" / "-") right:Sum
= left:Exp ("*" / "/") right:Fact
/ "(" in:Sum ")"