Class: Rule

page.BNF. Rule

Represents a BNF rule.


<private> new Rule(_nt, _symbols)

Creates a new BNF rule.

Parameters:
Name Type Description
_nt page.BNF.NT

left-hand side, non-terminal.

_symbols Array.<Node>

right-hand side.

Properties:
Name Type Description
nt page.BNF.NT

rule's non-terminal (left-hand side).

symbols Array.<Node>

rule's right-hand side.

index number

rule's index in page.BNF.rules, set after rule zero has been added.

empty boolean

true if no input can be accepted.

reached boolean

true if rule can be reached, transient.

finite boolean

true if all non-terminals in the right-hand side have page.BNF.NT.finite set, transient.

first Map

terminals at front, maps ord to page.BNF.T.

Source:
See:

Methods


dump()

Displays index, rule, empty, and content of first.

Source:
Returns:
Type
string

toString( [_mark])

Displays a rule in BNF notation.

Parameters:
Name Type Argument Description
_mark number <optional>

precedes a symbol on the right-hand side if it is in range.

Source:
Returns:
Type
string