class Pegasus::Pda::Grammar
- Pegasus::Pda::Grammar
- Reference
- Object
Overview
A Grammar associated with the language, contianing a list of terminals,
nonterminals, and the context-free production rules given by the Item
class.
Defined in:
pegasus/grammar.crConstructors
-
.new(terminals : Array(Pegasus::Elements::TerminalId), nonterminals : Array(Pegasus::Elements::NonterminalId))
Initializes this grammar with the given terminals and nonterminals.
Instance Method Summary
-
#add_item(i)
Add an item to the Grammar.
-
#create_lalr_pda(lr_pda)
Converts an LR(1) PDA to an LALR(1) PDA by merging states with the corresponding bodies, and combining the lookahead sets of every matching item.
-
#create_lr_pda
Create an LR(1) PDA given a start symbol.
-
#items : Array(Item)
The items that belong to this grammar.
-
#nonterminals : Array(Elements::NonterminalId)
The nonterminals that belong to this grammar.
-
#terminals : Array(Elements::TerminalId)
The terminals that belong to this grammar.
Constructor Detail
Initializes this grammar with the given terminals and nonterminals.
Instance Method Detail
Converts an LR(1) PDA to an LALR(1) PDA by merging states with the corresponding bodies, and combining the lookahead sets of every matching item.
The nonterminals that belong to this grammar.
The terminals that belong to this grammar.