classLr0Builder
final class Lr0Builder
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Builds the LR(0) automaton of a grammar from kernel items alone.
A state is identified by its kernel. Its closure is never materialised: the transitions out of it are computed from the kernel items and the precomputed closure index, which keeps grammars with thousands of rules tractable.
Methods§
public function build(Grammar $grammar): Lr0AutomatonBuilds the automaton.
Parameters
$grammar | Grammar | Grammar to build for |
Returns
Lr0Automaton The states in the order they were discovered, the start state firstTest cases 5
Called from 1
Calls 9
- new ClosureIndex line 30
- function-call
intdivline 40 - method-call ClosureIndex::startsWith() line 50
- method-call ClosureIndex::emptyRules() line 55
- function-call
array_keysline 61 - function-call
sortline 62 - function-call
implodeline 63 - function-call
countline 65 - new Lr0Automaton line 76
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.