Class: State

page.SLR1. State

Represents a state of the SLR(1) automaton.


<private> new State(_configs, _core, _actions)

Creates a representation for a new state of the SLR(1) automaton.

Parameters:
Name Type Description
_configs Array.<page.SLR1.Config>

core and closure defining this state.

_core number

number of marked rules in the core.

_actions Map

maps possible next symbols to null.

Properties:
Name Type Description
configs Array.<page.SLR1.Config>

core and closure defining this state.

core number

number of marked rules in the core.

actions Map

maps possible next symbols to actions.

Source:

Methods


advance(_factory, _stateNumber)

Creates and populates the state/symbol/action table. Fills in reduce for complete configurations, shift for terminals, accept for the end of input terminal, and goto for non-terminals. For conflict resolution see page.SLR1.

Parameters:
Name Type Description
_factory page.SLR1

the keeper of the state table, factory for new states.

_stateNumber number

this state's number.

Source:

dump(_core)

Displays all configurations and actions.

Parameters:
Name Type Description
_core boolean

if true, only displays core configurations.

Source:
Returns:
Type
string

equals(_core)

Compares a core of marked rules to this state's core.

Parameters:
Name Type Description
_core Array.<page.SLR1.Config>

to compare to this.

Source:
Returns:

true if this state has the same core (in any order).


toString()

Displays core configurations and actions.

Source:
Returns:
Type
string