Sha256: f0a992484b2ee3509ba4c8e94a44bdf9bb9e8363490844499c58dd696ec2a493

Contents?: true

Size: 500 Bytes

Versions: 10

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

# Load the builder class
require_relative '../../../lib/rley/syntax/base_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
    Rley::Syntax::BaseGrammarBuilder.new do
      add_terminals('a', 'b', 'c')
      rule 'S' => 'A'
      rule 'A' => 'a A c'
      rule 'A' => 'b'
    end
  end
end # module
# End of file

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rley-0.8.11 spec/rley/support/grammar_abc_helper.rb
rley-0.8.10 spec/rley/support/grammar_abc_helper.rb
rley-0.8.09 spec/rley/support/grammar_abc_helper.rb
rley-0.8.08 spec/rley/support/grammar_abc_helper.rb
rley-0.8.06 spec/rley/support/grammar_abc_helper.rb
rley-0.8.05 spec/rley/support/grammar_abc_helper.rb
rley-0.8.03 spec/rley/support/grammar_abc_helper.rb
rley-0.8.02 spec/rley/support/grammar_abc_helper.rb
rley-0.8.01 spec/rley/support/grammar_abc_helper.rb
rley-0.8.00 spec/rley/support/grammar_abc_helper.rb