EBNF Rule: Group

Prev:EBNF Rule: Sequence
Next:EBNF Rule: Choice

Any sequence of rules may be grouped using parentheses ( () ). The parenthesized sequence can then be modified as a group. Parentheses also delimit sets of choices separated by pipe (|) characters.

A group can also be delimited with curly braces ( {} ), in which case an implicit optional whitespace-matching rule will be inserted between rules sequenced within the braces.

USING: prettyprint peg.ebnf ; "abcca" EBNF[[ rule="a" ("b" | "c")* "a" ]] .
V{ "a" V{ "b" "c" "c" } "a" }

USING: prettyprint peg.ebnf ; "ab c d " EBNF[[ rule={"a" "b" "c" "d"} ]] .
V{ "a" "b" "c" "d" }