Class: Antelope::Grammar
- Inherits:
-
Object
- Object
- Antelope::Grammar
- Includes:
- Generation, Loading, Precedences, Productions, Symbols
- Defined in:
- lib/antelope/grammar.rb,
lib/antelope/grammar/token.rb,
lib/antelope/grammar/loading.rb,
lib/antelope/grammar/symbols.rb,
lib/antelope/grammar/generation.rb,
lib/antelope/grammar/precedence.rb,
lib/antelope/grammar/production.rb,
lib/antelope/grammar/precedences.rb,
lib/antelope/grammar/productions.rb,
lib/antelope/grammar/token/error.rb,
lib/antelope/grammar/token/epsilon.rb,
lib/antelope/grammar/token/terminal.rb,
lib/antelope/grammar/token/nonterminal.rb
Overview
Defines a grammar from an Ace file. This handles setting up productions, loading from files, symbols, precedence, and generation.
Defined Under Namespace
Modules: Generation, Loading, Precedences, Productions, Symbols Classes: Precedence, Production, Token
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.
-
#options ⇒ Hash
Extra options from the compiler.
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, #type_for
Methods included from Symbols
#contains_error_token?, #nonterminals, #symbols, #terminals, #typed_nonterminals
Constructor Details
#initialize(name, output, compiler) ⇒ Grammar
Initialize.
54 55 56 57 58 |
# File 'lib/antelope/grammar.rb', line 54 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.
46 47 48 |
# File 'lib/antelope/grammar.rb', line 46 def compiler @compiler end |
#name ⇒ String
The name of the grammar. This is normally assumed from a file name.
35 36 37 |
# File 'lib/antelope/grammar.rb', line 35 def name @name end |
#output ⇒ Pathname
The output directory for the grammar. This is normally the same directory as the Ace file.
41 42 43 |
# File 'lib/antelope/grammar.rb', line 41 def output @output end |
#states ⇒ Set<Generation::Recognizer::State>
Used by a generation class; this is all the generated states of the grammar.
29 30 31 |
# File 'lib/antelope/grammar.rb', line 29 def states @states end |
Instance Method Details
#options ⇒ Hash
Extra options from the compiler. This can be used by generators for output information.
64 65 66 |
# File 'lib/antelope/grammar.rb', line 64 def compiler.[:extra] end |