Moony Parser is a Javascript library for parsing texts.

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

Sum (

  Fact (

    Exp (

      Integer (/[0-9]+/) |

      Bra (Left ('('), In (@Sum), Right (')'))

    ) |

    MulDiv (Left (@Fact), In ('*' | '/'), Right (@Exp))

  ) |

  AddSub (Left (@Sum), In ('+' | '-'), Right (@Fact))

)

Start

  = Sum

Sum

  = left:Fact ("+" / "-") right:Sum

  / Fact

Fact

  = left:Exp ("*" / "/") right:Fact

  / Exp

Exp

  = Integer

  / "(" in:Sum ")"

Integer

  = digits:[0-9]+