beans 8.0.0

A parser generator library based on the Earley parser
Documentation
Option[content] ::=
  content@value <Some>
  <None>;

NonEmptyList[content, separation] ::=
  content@head <Nil>
  content@head separation NonEmptyList[content, separation]@tail <Cons>;

List[content, separation] ::=
  Option[NonEmptyList[content, separation]]@value <>;

Empty ::=
  <>;

"a file"
@File ::=
  List[ToplevelDeclaration, Empty]@decls <>;

"a declaration"
ToplevelDeclaration ::=
  Declaration@decl <Decl>
  MacroDecl@decl <Macro>;

"a declaration"
Declaration ::=
  Option[Comment]@comment Option[AT]@axiom ID.0@name DEF
  List[Rule, Empty]@rules SEMICOLON <>;

"a comment"
Comment ::=
  STRING.0@through <>;

"a declaration"
MacroDecl ::=
  ID.0@name LBRACKET List[FormalArgument, COMMA]@args RBRACKET DEF
  List[Rule, Empty]@rules SEMICOLON <>;

"a rule"
Rule ::=
  Option[Associativity]@assoc List[Element, Empty]@elements Proxy@proxy <>;

"an associativity specifier"
Associativity ::=
  LPAR LEFT RPAR <Left>
  LPAR RIGHT RPAR <Right>;

"a proxy"
Proxy ::=
  LPROXY List[ProxyItem, COMMA]@through RPROXY <>;

"a proxy item"
ProxyItem ::=
  ID.0@var <Variant>
  ID.0@key COLON Expression@value <Entry>;

"an argument"
FormalArgument ::=
  ID.0@name <>;

"an element"
Element ::=
  Item@item Option[Attribute]@attribute Option[Key]@key <>;

"an attribute"
Attribute ::=
  DOT ID.0@attribute <Named>
  DOT INT.0@attribute <Indexed>;

"a key"
Key ::=
  AT ID.0@key <>;

"an item"
Item ::=
  SELF <SelfNonTerminal>
  ID.0@name <Regular>
  ID.0@name LBRACKET List[Item, COMMA]@args RBRACKET <MacroInvocation>;

"an expression"
Expression ::=
  STRING.0@value <String>
  ID.0@name <Id>
  ID.0@name LBRACE List[ProxyItem, COMMA]@children RBRACE <Instanciation>;