Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Static Public Member Functions
grammar::convert::ToAutomaton Class Reference

#include <ToAutomaton.h>

Static Public Member Functions

template<class TerminalSymbolType , class NonterminalSymbolType >
static automaton::NFA< TerminalSymbolType, NonterminalSymbolType > convert (const grammar::LeftRG< TerminalSymbolType, NonterminalSymbolType > &grammar)
 
template<class TerminalSymbolType , class NonterminalSymbolType >
static automaton::NFA< TerminalSymbolType, NonterminalSymbolType > convert (const grammar::RightRG< TerminalSymbolType, NonterminalSymbolType > &grammar)
 
template<class T , class TerminalSymbolType = typename grammar::TerminalSymbolTypeOfGrammar < T >, class NonterminalSymbolType = typename grammar::NonterminalSymbolTypeOfGrammar < T >>
static automaton::NPDA< TerminalSymbolType, ext::variant< TerminalSymbolType, NonterminalSymbolType >, unsigned > convert (const T &grammar)
 

Detailed Description

Converts regular grammar to nondeterministic finite automaton. Sources: Melichar 2.98 (RightRG -> NFA) and 2.102 (LeftRG -> NFA).

Member Function Documentation

◆ convert() [1/3]

template<class TerminalSymbolType , class NonterminalSymbolType >
automaton::NFA< TerminalSymbolType, NonterminalSymbolType > grammar::convert::ToAutomaton::convert ( const grammar::LeftRG< TerminalSymbolType, NonterminalSymbolType > &  grammar)
static

Performs the conversion.

Template Parameters
TerminalSymbolTypethe type of terminal symbol of the grammar
NonterminalSymbolTypethe type of nonterminal symbol of the grammar
Parameters
grammarthe left regular grammar to convert.
Returns
finite automaton accepting the language generated by grammar.
Here is the call graph for this function:

◆ convert() [2/3]

template<class TerminalSymbolType , class NonterminalSymbolType >
automaton::NFA< TerminalSymbolType, NonterminalSymbolType > grammar::convert::ToAutomaton::convert ( const grammar::RightRG< TerminalSymbolType, NonterminalSymbolType > &  grammar)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters
TerminalSymbolTypethe type of terminal symbol of the grammar
NonterminalSymbolTypethe type of nonterminal symbol of the grammar
Parameters
grammarthe right regular grammar to convert.
Returns
finite automaton accepting the language generated by grammar.
Here is the call graph for this function:

◆ convert() [3/3]

template<class T , class TerminalSymbolType , class NonterminalSymbolType >
automaton::NPDA< TerminalSymbolType, ext::variant< TerminalSymbolType, NonterminalSymbolType >, unsigned > grammar::convert::ToAutomaton::convert ( const T &  grammar)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters
Tthe type of converted grammar
TerminalSymbolTypethe type of terminal symbol of the grammar
NonterminalSymbolTypethe type of nonterminal symbol of the grammar
Parameters
grammarsome context free grammar.
Returns
pushdown automaton accepting the language generated by grammar.
Here is the call graph for this function:

The documentation for this class was generated from the following file: