class CLTK::CFG

Defined in:

cltk/cfg.cr
cltk/cfg/item.cr
cltk/cfg/production.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Class Method Detail

def self.is_nonterminal?(sym) #

[View source]
def self.is_terminal?(sym) #

[View source]

Instance Method Detail

def add_production(production) #

Adds production to the appropriate internal data structures.

@param [Production] production The production to add to the grammar.

@return [void]


[View source]
def build_list_production(name : String, list_elements : String | Array(String), separator = "") #

[View source]
def build_nonempty_list_production(name : String, list_elements : String | Array(String), separator = "") #

[View source]
def build_optional_production(name : String, opt_symbol : String) #

[View source]
def callback(&callback : Symbol, Symbol, Production, Array(Int32) -> Nil) #

[View source]
def clause(expression : Symbol | String) #

[View source]
def curr_lhs : String? #

[View source]
def curr_lhs=(curr_lhs : Nil | String) #

[View source]
def first_set(sentence : String | Array(String)) : Array(String) #

[View source]
def follow_set(sym0 : String, seen_lh_sides = [] of String) : Array(String) #

[View source]
def get_list_production(name, list_elements : String | Array(String), separator = "") #

[View source]
def get_nonempty_list_production(name : String, list_elements : String | Array(String), separator = "") #

[View source]
def get_optional_production(name : String, list_elements : String | Array(String)) #

[View source]
def next_id #

@return [Integer] ID for the next production to be defined.


[View source]
def nonterms #

[View source]
def production(symbol : Symbol | String, expression : String | Nil = nil, &) #

[View source]
def production(symbol : Symbol | String, expression : String | Nil = nil) #

[View source]
def productions_id : Hash(Int32, CLTK::CFG::Production) #

[View source]
def productions_sym : Hash(String, Array(CLTK::CFG::Production)) #

[View source]
def start_symbol : String #

[View source]
def symbols #

@return [Array] All symbols used in the grammar's definition.


[View source]
def terms #

[View source]
def with_curr_lhs(symbol, &) #

[View source]