Class: Dendroid::Syntax::NonTerminal
- Defined in:
- lib/dendroid/syntax/non_terminal.rb
Overview
A non-terminal symbol (sometimes called a syntactic variable) represents a composition of terminal or non-terminal symbols
Instance Attribute Summary collapse
-
#nullable ⇒ Boolean
True if symbol can derive the null token.
-
#productive ⇒ Boolean
True iff the symbol always matches a non-empty sequence of terminal symbols.
Attributes inherited from GrmSymbol
Instance Method Summary collapse
-
#nullable? ⇒ Boolean
Predicate method to check whether the symbol can derive (match) the null token.
-
#productive? ⇒ Boolean
Predicate method to check whether the symbol always matches a non-empty sequence of terminal symbols.
-
#terminal? ⇒ FalseClass
Predicate method to check whether the symbol is a terminal symbol.
Methods inherited from GrmSymbol
Constructor Details
This class inherits a constructor from Dendroid::Syntax::GrmSymbol
Instance Attribute Details
#nullable ⇒ Boolean
Returns true if symbol can derive the null token.
11 12 13 |
# File 'lib/dendroid/syntax/non_terminal.rb', line 11 def nullable @nullable end |
#productive ⇒ Boolean
Returns true iff the symbol always matches a non-empty sequence of terminal symbols.
15 16 17 |
# File 'lib/dendroid/syntax/non_terminal.rb', line 15 def productive @productive end |
Instance Method Details
#nullable? ⇒ Boolean
Predicate method to check whether the symbol can derive (match) the null token.
26 27 28 |
# File 'lib/dendroid/syntax/non_terminal.rb', line 26 def nullable? @nullable end |
#productive? ⇒ Boolean
Predicate method to check whether the symbol always matches a non-empty sequence of terminal symbols.
33 34 35 |
# File 'lib/dendroid/syntax/non_terminal.rb', line 33 def productive? @productive end |
#terminal? ⇒ FalseClass
Predicate method to check whether the symbol is a terminal symbol.
19 20 21 |
# File 'lib/dendroid/syntax/non_terminal.rb', line 19 def terminal? false end |