final class Lr0Automaton
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

The states of an LR(0) automaton, their transitions and their completed rules.

Properties§

public list<list<int>> $kernels
public list<array<int, int>> $transitions
public list<list<int>> $reductions

Methods§

public function __construct(
    public list<list<int>> $kernels,
    public list<array<int, int>> $transitions,
    public list<list<int>> $reductions,
)

Parameters

$kernelslist<list<int>>Kernel items of each state, sorted
$transitionslist<array<int, int>>Target state by symbol, per state
$reductionslist<list<int>>Rules completed in each state, in rule order
public function stateCount(): int

Answers how many states there are.

Returns

int State count
Test cases 1
Calls 1
public function transition(int $state, int $symbol): int|null

Answers the state reached on a symbol, if any.

Parameters

$stateintState to leave
$symbolintSymbol to move on

Returns

int|null The target state, or null when the state has no such transition
Test cases 1

Test cases 6§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 2
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type declarations 3