Class: Collie::Analyzer::Conflict

Inherits:
Object
  • Object
show all
Defined in:
lib/collie/analyzer/conflict.rb

Overview

Conflict detection helpers for grammar analysis

Instance Method Summary collapse

Constructor Details

#initialize(grammar, symbol_table) ⇒ Conflict

Returns a new instance of Conflict.



9
10
11
12
13
# File 'lib/collie/analyzer/conflict.rb', line 9

def initialize(grammar, symbol_table)
  @grammar = grammar
  @symbol_table = symbol_table
  @precedence_map = {}
end

Instance Method Details

#analyzeObject



15
16
17
18
19
20
21
22
# File 'lib/collie/analyzer/conflict.rb', line 15

def analyze
  build_precedence_map
  {
    potential_shift_reduce: detect_shift_reduce_conflicts,
    potential_reduce_reduce: detect_reduce_reduce_conflicts,
    ambiguous_precedence: detect_ambiguous_precedence
  }
end