Class: Calyx::Production::NonTerminal
- Inherits:
-
Object
- Object
- Calyx::Production::NonTerminal
- Defined in:
- lib/calyx/production/non_terminal.rb
Overview
A type of production rule that represents a non-terminal expansion, linking one rule to another.
Instance Method Summary collapse
-
#evaluate(rng) ⇒ Array
Evaluate the non-terminal, using the registry to handle the expansion.
-
#initialize(symbol, registry) ⇒ NonTerminal
constructor
Construct a non-terminal node, given the symbol to lookup and the registry to look it up in.
Constructor Details
#initialize(symbol, registry) ⇒ NonTerminal
Construct a non-terminal node, given the symbol to lookup and the registry to look it up in.
11 12 13 14 |
# File 'lib/calyx/production/non_terminal.rb', line 11 def initialize(symbol, registry) @symbol = symbol.to_sym @registry = registry end |
Instance Method Details
#evaluate(rng) ⇒ Array
Evaluate the non-terminal, using the registry to handle the expansion.
19 20 21 |
# File 'lib/calyx/production/non_terminal.rb', line 19 def evaluate(rng) [@symbol, @registry.(@symbol).evaluate(rng)] end |