class Rley::Syntax::NonTerminal
A non-terminal symbol (sometimes called a syntactic variable) represents a composition of terminal or non-terminal symbols
Attributes
An indicator that tells whether the grammar symbol can generate a non-empty string of terminals.
A non-terminal symbol is nullable if it can match an empty string.
A non-terminal symbol is undefined if no production rule in the grammar has that non-terminal symbol in its left-hand side.
A non-terminal symbol is unreachable if it cannot be reached (derived) from the start symbol.
Public Instance Methods
Source
# File lib/rley/syntax/non_terminal.rb, line 30 def nullable? return @nullable end
@return [false/true] Return true if the symbol derives the empty string. As non-terminal symbol is nullable when it can can match to zero input token. The “nullability” of a non-terminal can practically be determined once all the production rules of the grammar are specified.
Source
# File lib/rley/syntax/non_terminal.rb, line 36 def undefined? return @undefined end
@return [false/true] Return true if the symbol doesn’t appear on the left-hand side of any production rule.
Source
# File lib/rley/syntax/non_terminal.rb, line 42 def unreachable? return @unreachable end
@return [false/true] Return true if the symbol cannot be derived from the start symbol.