Sha256: 2a2cbbff488cdc9d22ea6babf0e191b81215ff7bec1dc1910aeba6f55f9d99ac

Contents?: true

Size: 494 Bytes

Versions: 8

Compression:

Stored size: 494 Bytes

Contents

# 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' => %w(a A c)
      rule 'A' => 'b'
    end

    return builder
  end
end # module
# End of file

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rley-0.4.06 spec/rley/support/grammar_abc_helper.rb
rley-0.4.05 spec/rley/support/grammar_abc_helper.rb
rley-0.4.04 spec/rley/support/grammar_abc_helper.rb
rley-0.4.03 spec/rley/support/grammar_abc_helper.rb
rley-0.4.02 spec/rley/support/grammar_abc_helper.rb
rley-0.4.01 spec/rley/support/grammar_abc_helper.rb
rley-0.4.00 spec/rley/support/grammar_abc_helper.rb
rley-0.3.12 spec/rley/support/grammar_abc_helper.rb