Class: Antelope::Ace::Grammar
- Inherits:
-
Object
- Object
- Antelope::Ace::Grammar
- Includes:
- Generation, Loading, Precedences, Productions, Terminals
- Defined in:
- lib/antelope/ace/grammar.rb,
lib/antelope/ace/grammar/loading.rb,
lib/antelope/ace/grammar/terminals.rb,
lib/antelope/ace/grammar/generation.rb,
lib/antelope/ace/grammar/production.rb,
lib/antelope/ace/grammar/precedences.rb,
lib/antelope/ace/grammar/productions.rb
Overview
Defines a grammar from an Ace file. This handles setting up productions, loading from files, terminals, precedence, and generation.
Defined Under Namespace
Modules: Generation, Loading, Precedences, Productions, Terminals Classes: Production
Constant Summary collapse
- DEFAULT_MODIFIERS =
The default modifiers for generation. It's not really recommended to (heh) modify this; however, adding your own modifier is always acceptable.
[ [:recognizer, Generation::Recognizer ], [:constructor, Generation::Constructor], [:tableizer, Generation::Tableizer ] ].freeze
- DEFAULT_GENERATORS =
{ "ruby" => [Generator::Ruby] }
Instance Attribute Summary collapse
-
#compiler ⇒ Compiler
readonly
The compiler for the Ace file.
-
#name ⇒ String
The name of the grammar.
-
#output ⇒ Pathname
The output directory for the grammar.
-
#states ⇒ Set<Generation::Recognizer::State>
Used by a generation class; this is all the generated states of the grammar.
Instance Method Summary collapse
-
#initialize(name, output, compiler) ⇒ Grammar
constructor
Initialize.
Methods included from Generation
Methods included from Loading
Methods included from Precedences
#generate_precedence, #precedence, #precedence_for
Methods included from Productions
#all_productions, #default_production, #find_token, #generate_production_for, #generate_productions, #productions
Methods included from Terminals
#nonterminals, #symbols, #terminals
Constructor Details
#initialize(name, output, compiler) ⇒ Grammar
Initialize.
52 53 54 55 56 |
# File 'lib/antelope/ace/grammar.rb', line 52 def initialize(name, output, compiler) @name = name @output = Pathname.new(output) @compiler = compiler end |
Instance Attribute Details
#compiler ⇒ Compiler (readonly)
The compiler for the Ace file.
44 45 46 |
# File 'lib/antelope/ace/grammar.rb', line 44 def compiler @compiler end |
#name ⇒ String
The name of the grammar. This is normally assumed from a file name.
33 34 35 |
# File 'lib/antelope/ace/grammar.rb', line 33 def name @name end |
#output ⇒ Pathname
The output directory for the grammar. This is normally the same directory as the Ace file.
39 40 41 |
# File 'lib/antelope/ace/grammar.rb', line 39 def output @output end |
#states ⇒ Set<Generation::Recognizer::State>
Used by a generation class; this is all the generated states of the grammar.
27 28 29 |
# File 'lib/antelope/ace/grammar.rb', line 27 def states @states end |