Closure in ABNF grammars.
A rule's definiens may reference (i.e. ``call'') other rules.
Those rules may in turn call further rules,
and so on until a ``closed'' set of rules is reached.
When grammars are modularly defined, a grammar may not be closed,
but after the modules are composed into one grammar for parsing,
the resulting grammar should be closed.
When composing grammars, sometimes only a portion of a grammar is selected,
consisting of a subset of its rules (perhaps called by other grammars)
along with their closure.
- Calculate the rules from a list of rules
that transitively define names in a list of rule names,
collecting them into an accumulator (list of rules).
- Separate from some rules the ones that define a rule name.
- Rule names that are defined in a list of rules
but not used anywhere in those rules.
- Find the rules from a list of rules
that transitively define the names in a list of rule names.
- Rule names that occur in (the definientia of) a list of rules.
- Rule names that are defined in a list of rules.
- A rule list is closed iff it defines all the rules that it calls.
- Rule names that occur in (the definiens of) a rule.
- Rule names that occur in an element.
- Rule names that occur in a concatenation.
- Rule names that occur in an alternation.
- Rule names that occur in a repetition.