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/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
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
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.
53 54 55 56 57 |
# File 'lib/antelope/ace/grammar.rb', line 53 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.
45 46 47 |
# File 'lib/antelope/ace/grammar.rb', line 45 def compiler @compiler end |
#name ⇒ String
The name of the grammar. This is normally assumed from a file name.
34 35 36 |
# File 'lib/antelope/ace/grammar.rb', line 34 def name @name end |
#output ⇒ Pathname
The output directory for the grammar. This is normally the same directory as the Ace file.
40 41 42 |
# File 'lib/antelope/ace/grammar.rb', line 40 def output @output end |
#states ⇒ Set<Generation::Recognizer::State>
Used by a generation class; this is all the generated states of the grammar.
28 29 30 |
# File 'lib/antelope/ace/grammar.rb', line 28 def states @states end |