class Antelope::Grammar

Defines a grammar from an Ace file. This handles setting up productions, loading from files, symbols, precedence, and generation.

Constants

DEFAULT_MODIFIERS

The default modifiers for generation. It’s not really recommended to (heh) modify this; however, adding your own modifier is always acceptable.

Precedence

Defines a precedence. A precedence has a type, tokens, and a level.

Production

Defines a production.

Attributes

compiler[R]

The compiler for the Ace file.

@return [Compiler]

name[RW]

The name of the grammar. This is normally assumed from a file name.

@return [String]

output[RW]

The output directory for the grammar. This is normally the same directory as the Ace file.

@return [Pathname]

states[RW]

Used by a generation class; this is all the generated states of the grammar.

@return [Set<Generation::Recognizer::State>] @see Generation::Recognizer

Public Class Methods

new(name, output, compiler) click to toggle source

Initialize.

@param name [String] @param output [String] the output directory. Automagically

turned into a Pathname.

@param compiler [Compiler]

# File lib/antelope/grammar.rb, line 54
def initialize(name, output, compiler)
  @name     = name
  @output   = Pathname.new(output)
  @compiler = compiler
end

Public Instance Methods

options() click to toggle source

Extra options from the compiler. This can be used by generators for output information.

@return [Hash]

# File lib/antelope/grammar.rb, line 64
def options
  compiler.options[:extra]
end