Sha256: acd0e2f2373c50534cac6eed4e254846f8273e0d627f2ca183fe9f560f4649d4
Contents?: true
Size: 749 Bytes
Versions: 10
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true # Load the builder class require_relative '../../../lib/rley/syntax/base_grammar_builder' module GrammarSPPFHelper # Factory method. Creates a grammar builder for a # grammar described in paper from Elisabeth Scott # "SPPF-Style Parsing From Earley Recognizers" in # Notes in Theoretical Computer Science 203, (2008), pp. 53-67 # contains a hidden left recursion and a cycle def grammar_sppf_builder builder = Rley::Syntax::BaseGrammarBuilder.new do add_terminals('a', 'b') rule 'Phi' => 'S' rule 'S' => %w[A T] rule 'S' => %w[a T] rule 'A' => 'a' rule 'A' => %w[B A] rule 'B' => [] rule 'T' => %w[b b b] end return builder end end # module
Version data entries
10 entries across 10 versions & 1 rubygems