class CLTK::CFG::Production
- CLTK::CFG::Production
- Reference
- Object
Overview
Oddly enough, the Production class represents a production in a context-free grammar.
Direct Known Subclasses
Defined in:
cltk/cfg/production.crConstructors
- 
        .new(id : Int32, lhs : String, rhs : Array(String))
        
          Instantiates a new Production object with the specified ID, and left- and right-hand sides. 
Instance Method Summary
- 
        #==(other)
        
          Comparese on production to another. 
- 
        #copy
        
          @return [Production] A new copy of this production. 
- 
        #id : Int32
        
          @return [Integer] ID of this production. 
- 
        #last_terminal
        
          @return [Symbol] The last terminal in the right-hand side of the production. 
- 
        #lhs : String
        
          @return [Symbol] Left-hand side of this production. 
- 
        #rhs : Array(String)
        
          @return [Array ] Right-hand side of this production. 
- 
        #to_item
        
          @return [Item] An Item based on this production. 
- 
        #to_s(padding = 0)
        
          Returns a string representation of this production. 
Instance methods inherited from class Object
  
  
    
      in?(collection : Array | Set)
    in?
    
  
    
    
  
Constructor Detail
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
Instance Method Detail
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]
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]