Sha256: 08ff92dd4e755d85297206e7d0166a95a160f0a4759d4a966ac75166c7709a08

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

# Load the builder class
require_relative '../../../lib/rley/syntax/grammar_builder'

module GrammarABCHelper
  # Factory method. Creates a grammar builder for a simple grammar.
  # (based on example in N. Wirth "Compiler Construction" book, p. 6)
  def grammar_abc_builder()
    builder = Rley::Syntax::GrammarBuilder.new do
      add_terminals('a', 'b', 'c')
      rule 'S' => 'A'
      rule 'A' => 'a A c'
      rule 'A' => 'b'
    end

    return builder
  end
end # module
# End of file

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rley-0.7.07 spec/rley/support/grammar_abc_helper.rb
rley-0.7.06 spec/rley/support/grammar_abc_helper.rb
rley-0.7.05 spec/rley/support/grammar_abc_helper.rb
rley-0.7.04 spec/rley/support/grammar_abc_helper.rb