Sha256: 38eb50c59c54290fd48c6f6678e3767962989c663789220f0c2e6dfd27565619
Contents?: true
Size: 618 Bytes
Versions: 2
Compression:
Stored size: 618 Bytes
Contents
module Panini # The Grammar stores the start symbol and nonterminals. class Grammar def initialize @nonterminals = [] end # Returns the grammar's start symbol. This will always be the first # nonterminal added to the grammar. def start @nonterminals[0] end # Add a nonterminal to the grammar. def add_nonterminal(name = nil) Panini::Nonterminal.new(name).tap do |new_nonterminal| @nonterminals << new_nonterminal end end # The list of nonterminals in the grammar. def nonterminals @nonterminals.dup end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
panini-1.1.0 | lib/grammar.rb |
panini-1.0.0 | lib/grammar.rb |