Sha256: 4989e37da4d0f5878abda4099fb319ed22ae2c2d85a1d1e8105df1f4bad0946d

Contents?: true

Size: 607 Bytes

Versions: 7

Compression:

Stored size: 607 Bytes

Contents

# Purpose: to demonstrate how to build and render a parse tree for JSON
# language
require_relative 'tokenizer'
require_relative 'grammar'
module SRL
  # A parser for a subset of Simple Regex Language
  class Parser < Rley::Parser::GFGEarleyParser
    attr_reader(:source_file)

    # Constructor
    def initialize()
      # Builder the Earley parser with the calculator grammar
      super(Grammar)
    end

    def parse_SRL(aText)
      lexer = Tokenizer.new(aText, grammar)
      tokens = lexer.tokens
      result = parse(tokens)

      return result
    end
  end # class
end # module

# End of file

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rley-0.5.14 examples/general/SRL/lib/parser.rb
rley-0.5.13 examples/general/SRL/lib/parser.rb
rley-0.5.12 examples/general/SRL/lib/parser.rb
rley-0.5.11 examples/general/SRL/lib/parser.rb
rley-0.5.10 examples/general/SRL/lib/parser.rb
rley-0.5.09 examples/general/SRL/lib/parser.rb
rley-0.5.08 examples/general/SRL/lib/parser.rb