Sha256: 34bc7e52b1a5a253cdf12c33539e9ec2219fe220efe227b5d54d70f4666c856b
Contents?: true
Size: 711 Bytes
Versions: 8
Compression:
Stored size: 711 Bytes
Contents
# Load the builder class require_relative '../../../lib/rley/syntax/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::GrammarBuilder.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
8 entries across 8 versions & 1 rubygems