class CLTK::CFG::Production

Overview

Oddly enough, the Production class represents a production in a context-free grammar.

Direct Known Subclasses

Defined in:

cltk/cfg/production.cr
cltk/parser/msgpack.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Class Method Detail

def self.new(id : Int32, lhs : String, rhs : Array(String)) #

Instantiates a new Production object with the specified ID, and left- and right-hand sides.

@param [Integer] id ID number of this production. @param [Symbol] lhs Left-hand side of the production. @param [Array<Symbol>] rhs Right-hand side of the production.


[View source]
def self.new(__temp_80 : MessagePack::Unpacker) #

[View source]

Instance Method Detail

def ==(other) #

Comparese on production to another. Returns true only if the left- and right- hand sides match.

@param [Production] other Another production to compare to.

@return [Boolean]


[View source]
def copy #

@return [Production] A new copy of this production.


[View source]
def id : Int32 #

[View source]
def id=(_id : Int32) #

[View source]
def last_terminal #

@return [Symbol] The last terminal in the right-hand side of the production.


[View source]
def lhs : String #

[View source]
def lhs=(_lhs : String) #

[View source]
def rhs : Array(String) #

[View source]
def rhs=(_rhs : Array(String)) #

[View source]
def to_item #

@return [Item] An Item based on this production.


[View source]
def to_msgpack(packer : MessagePack::Packer) #

[View source]
def to_s(padding = 0) #

Returns a string representation of this production.

@param [Integer] padding The ammount of padding spaces to add to the beginning of the string.

@return [String]


[View source]