def verify_first_first(compiled_grammar)
      compiled_grammar.rules.each do |rule|
        conflicting = Set.new

        rule.branches.each do |branch|
          next if conflicting.include?(branch)

          rule.branches.each do |other_branch|
            next if branch == other_branch || conflicting.include?(other_branch)

            overlapping = branch.first_set & other_branch.first_set

            unless overlapping.empty?
              conflicting << branch
              conflicting << other_branch
            end
          end
        end

        unless conflicting.empty?
          compiled_grammar.add_error(
            'first/first conflict, multiple branches start with the same terminals',
            rule.source_line
          )

          conflicting.each do |branch|
            labels = branch.first_set.map do |token|
              token.is_a?(Epsilon) ? 'epsilon' : token.name
            end

            compiled_grammar.add_error(
              "branch starts with: #{labels.join(', ')}",
              branch.source_line
            )
          end
        end
      end
    end
def verify_first_first(compiled_grammar)
      compiled_grammar.rules.each do |rule|
        conflicting = Set.new

        rule.branches.each do |branch|
          next if conflicting.include?(branch)

          rule.branches.each do |other_branch|
            next if branch == other_branch || conflicting.include?(other_branch)

            overlapping = branch.first_set & other_branch.first_set

            unless overlapping.empty?
              conflicting << branch
              conflicting << other_branch
            end
          end
        end

        unless conflicting.empty?
          compiled_grammar.add_error(
            'first/first conflict, multiple branches start with the same terminals',
            rule.source_line
          )

          conflicting.each do |branch|
            labels = branch.first_set.map do |token|
              token.is_a?(Epsilon) ? 'epsilon' : token.name
            end

            compiled_grammar.add_error(
              "branch starts with: #{labels.join(', ')}",
              branch.source_line
            )
          end
        end
      end
    end
Verifies all rules to see if they don't have any first/first conflicts.
 Errors are added for every rule where this _is_ the case.

 @param [LL::CompiledGrammar] compiled_grammar