Class: Rley::Parser::BaseParser

Inherits:
Object
  • Object
show all
Includes:
GrmItemsBuilder
Defined in:
lib/rley/parser/base_parser.rb

Overview

Abstract class for Earley parser.

Direct Known Subclasses

GFGEarleyParser

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GrmItemsBuilder

#build_dotted_items

Constructor Details

#initialize(aGrammar) ⇒ BaseParser

Returns a new instance of BaseParser.



19
20
21
22
# File 'lib/rley/parser/base_parser.rb', line 19

def initialize(aGrammar)
  @grammar = aGrammar
  @dotted_items = build_dotted_items(grammar) # Method from mixin
end

Instance Attribute Details

#dotted_itemsObject (readonly)

The dotted items/rules for the productions of the grammar



16
17
18
# File 'lib/rley/parser/base_parser.rb', line 16

def dotted_items
  @dotted_items
end

#grammarObject (readonly)

The grammar of the language.



13
14
15
# File 'lib/rley/parser/base_parser.rb', line 13

def grammar
  @grammar
end