Skip to content
Snippets Groups Projects
Commit e8977ccd authored by Jan Trávníček's avatar Jan Trávníček
Browse files

user documentation of regexp conversion algos

parent 9f611dd2
No related branches found
No related tags found
No related merge requests found
Showing
with 117 additions and 34 deletions
......@@ -33,7 +33,7 @@ public:
*
* \param regexp the regular expression
*
* \return finite automaotn equivalent to original regular expression.
* \return finite automaotn equivalent to original regular expression
*/
template < class SymbolType >
static automaton::NFA < SymbolType, ext::pair < SymbolType, unsigned > > convert ( const regexp::FormalRegExp < SymbolType > & regexp );
......@@ -45,7 +45,7 @@ public:
*
* \param regexp the regular expression
*
* \return finite automaotn equivalent to original regular expression.
* \return finite automaotn equivalent to original regular expression
*/
template < class SymbolType >
static automaton::NFA < SymbolType, ext::pair < SymbolType, unsigned > > convert ( const regexp::UnboundedRegExp < SymbolType > & regexp );
......
......@@ -12,8 +12,17 @@ namespace regexp {
 
namespace convert {
 
auto ToAutomatonDerivationFormalRegExp = registration::AbstractRegister < ToAutomatonDerivation, automaton::DFA < DefaultSymbolType, unsigned >, const regexp::FormalRegExp < > & > ( ToAutomatonDerivation::convert );
auto ToAutomatonDerivationUnboundedRegExp = registration::AbstractRegister < ToAutomatonDerivation, automaton::DFA < DefaultSymbolType, unsigned >, const regexp::UnboundedRegExp < > & > ( ToAutomatonDerivation::convert );
auto ToAutomatonDerivationFormalRegExp = registration::AbstractRegister < ToAutomatonDerivation, automaton::DFA < DefaultSymbolType, unsigned >, const regexp::FormalRegExp < > & > ( ToAutomatonDerivation::convert ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Brzozowski's derivation algorithm.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
auto ToAutomatonDerivationUnboundedRegExp = registration::AbstractRegister < ToAutomatonDerivation, automaton::DFA < DefaultSymbolType, unsigned >, const regexp::UnboundedRegExp < > & > ( ToAutomatonDerivation::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Brzozowski's derivation algorithm.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
 
} /* namespace convert */
 
......
......@@ -34,8 +34,14 @@ namespace convert {
class ToAutomatonDerivation {
public:
/**
* Performs conversion.
* @return FSM equivalent to original regular expression.
* Implements conversion of regular expressions to finite automata usign Brzozowski's derivation algorithm.
*
* \tparam T the type of regular expression to convert
* \tparam SymbolType the type of symbols in the regular expression
*
* \param regexp the regexp to convert
*
* \return finite automaton accepting the language described by the original regular expression
*/
template < class T, class SymbolType = typename T::symbol_type >
static automaton::DFA < SymbolType, unsigned > convert ( const T & regexp );
......
......@@ -12,8 +12,17 @@ namespace regexp {
 
namespace convert {
 
auto ToAutomatonGlushkovUnboundedRegExp = registration::AbstractRegister < ToAutomatonGlushkov, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToAutomatonGlushkov::convert );
auto ToAutomatonGlushkovFormalRegExp = registration::AbstractRegister < ToAutomatonGlushkov, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToAutomatonGlushkov::convert );
auto ToAutomatonGlushkovUnboundedRegExp = registration::AbstractRegister < ToAutomatonGlushkov, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToAutomatonGlushkov::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
auto ToAutomatonGlushkovFormalRegExp = registration::AbstractRegister < ToAutomatonGlushkov, automaton::NFA < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToAutomatonGlushkov::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
 
} /* namespace convert */
 
......
......@@ -38,9 +38,13 @@ namespace convert {
class ToAutomatonGlushkov {
public:
/**
* Performs conversion.
* @param re Original regular expression.
* @return NFA equivalent to original regular expression.
* Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.
*
* \tparam SymbolType the type of symbols in the regular expression
*
* \param regexp the regexp to convert
*
* \return finite automaton accepting the language described by the original regular expression
*/
template < class SymbolType >
static automaton::NFA < SymbolType, ext::pair < SymbolType, unsigned > > convert ( const regexp::UnboundedRegExp < SymbolType > & regexp );
......
......@@ -51,8 +51,17 @@ automaton::EpsilonNFA < > ToAutomatonThompson::convert(const regexp::UnboundedRe
return automaton;
}
 
auto ToAutomatonThompsonFormalRegExp = registration::AbstractRegister < ToAutomatonThompson, automaton::EpsilonNFA < >, const regexp::FormalRegExp < > & > ( ToAutomatonThompson::convert );
auto ToAutomatonThompsonUnboundedRegExp = registration::AbstractRegister < ToAutomatonThompson, automaton::EpsilonNFA < >, const regexp::UnboundedRegExp < > & > ( ToAutomatonThompson::convert );
auto ToAutomatonThompsonFormalRegExp = registration::AbstractRegister < ToAutomatonThompson, automaton::EpsilonNFA < >, const regexp::FormalRegExp < > & > ( ToAutomatonThompson::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Thompson's method of incremental construction.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
auto ToAutomatonThompsonUnboundedRegExp = registration::AbstractRegister < ToAutomatonThompson, automaton::EpsilonNFA < >, const regexp::UnboundedRegExp < > & > ( ToAutomatonThompson::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Thompson's method of incremental construction.\n\
\n\
@param regexp the regexp to convert\n\
@return finite automaton accepting the language described by the original regular expression" );
 
// ----------------------------------------------------------------------------
 
......
......@@ -29,11 +29,19 @@ namespace convert {
class ToAutomatonThompson {
public:
/**
* Performs conversion.
* @param regexp regexp to convert
* @return nondeterministic finite automaton with epsilon transitions accepting language described by the regexp
* Implements conversion of regular expressions to finite automata usign Thompson's method of incremental construction.
*
* \tparam SymbolType the type of symbols in the regular expression
*
* \param regexp the regexp to convert
*
* \return finite automaton accepting the language described by the original regular expression
*/
static automaton::EpsilonNFA < > convert(const regexp::FormalRegExp < > & regexp);
/**
* \overload
*/
static automaton::EpsilonNFA < > convert(const regexp::UnboundedRegExp < > & regexp);
 
class Unbounded {
......
......@@ -12,8 +12,17 @@ namespace regexp {
 
namespace convert {
 
auto ToGrammarFormalRegExp = registration::AbstractRegister < ToGrammar, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToGrammar::convert );
auto ToGrammarUnboundedRegExp = registration::AbstractRegister < ToGrammar, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToGrammar::convert );
auto ToGrammarFormalRegExp = registration::AbstractRegister < ToGrammar, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToGrammar::convert, "regexp" ).setDocumentation (
"Converts the regular expression into a grammar (@sa regexp::convert::ToGrammarRightRGGlushkov::convert).\n\
\n\
@param regexp the regular expression\n\
@return right regular grammar equivalent to original regular expression" );
auto ToGrammarUnboundedRegExp = registration::AbstractRegister < ToGrammar, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToGrammar::convert, "regexp" ).setDocumentation (
"Converts the regular expression into a grammar (@sa regexp::convert::ToGrammarRightRGGlushkov::convert).\n\
\n\
@param regexp the regular expression\n\
@return right regular grammar equivalent to original regular expression" );
 
} /* namespace convert */
 
......
......@@ -14,16 +14,21 @@ namespace regexp {
 
namespace convert {
 
/**
* Conversion of regular expression to regular grammar.
* This class serves as a "default wrapper" over the conversion of RE to RG. It delegates to the glushkov conversion algorithm.
* @sa regexp::convert::ToGrammarRightRGGlushkov
*/
class ToGrammar {
public:
/**
* Performs conversion.
* Converts the regular expression into a grammar (@sa regexp::convert::ToGrammarRightRGGlushkov::convert).
*
* \tparam SymbolType type of symbols in the regexp
* \tparam SymbolType the type of regular expression
*
* \param regexp the converted regexp
* \param regexp the regular expression
*
* \return right regular grammar equivalent to source regexp.
* \return right regular grammar equivalent to original regular expression.
*/
template < class SymbolType >
static grammar::RightRG < SymbolType, ext::pair < SymbolType, unsigned > > convert(const regexp::FormalRegExp < SymbolType > & regexp);
......
......@@ -12,8 +12,17 @@ namespace regexp {
 
namespace convert {
 
auto ToGrammarRightRGDerivationUnboundedRegExp = registration::AbstractRegister < ToGrammarRightRGDerivation, grammar::RightRG < DefaultSymbolType, unsigned >, const regexp::UnboundedRegExp < > & > ( ToGrammarRightRGDerivation::convert );
auto ToGrammarRightRGDerivationFormalRegExp = registration::AbstractRegister < ToGrammarRightRGDerivation, grammar::RightRG < DefaultSymbolType, unsigned >, const regexp::FormalRegExp < > & > ( ToGrammarRightRGDerivation::convert );
auto ToGrammarRightRGDerivationUnboundedRegExp = registration::AbstractRegister < ToGrammarRightRGDerivation, grammar::RightRG < DefaultSymbolType, unsigned >, const regexp::UnboundedRegExp < > & > ( ToGrammarRightRGDerivation::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to regular grammars usign Brzozowski's derivation algorithm.\n\
\n\
@param regexp the regexp to convert\n\
@return right regular grammar generating the language described by the original regular expression" );
auto ToGrammarRightRGDerivationFormalRegExp = registration::AbstractRegister < ToGrammarRightRGDerivation, grammar::RightRG < DefaultSymbolType, unsigned >, const regexp::FormalRegExp < > & > ( ToGrammarRightRGDerivation::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to regular grammars usign Brzozowski's derivation algorithm.\n\
\n\
@param regexp the regexp to convert\n\
@return right regular grammar generating the language described by the original regular expression" );
 
} /* namespace convert */
 
......
......@@ -29,14 +29,20 @@ namespace regexp {
namespace convert {
 
/**
* Converts reg. expression to right regular grammar using brzozowski derivation algorithm.
* Converts regular expression to right regular grammar using Brzozowski's derivation algorithm.
* Source: Melichar 2.137
*/
class ToGrammarRightRGDerivation {
public:
/**
* Performs conversion.
* @return right regular grammar equivalent to source regexp.
* Implements conversion of regular expressions to regular grammars usign Brzozowski's derivation algorithm.
*
* \tparam T the type of regular expression to convert
* \tparam SymbolType the type of symbols in the regular expression
*
* \param regexp the regexp to convert
*
* \return right regular grammar generating the language described by the original regular expression
*/
template < class T, class SymbolType = typename regexp::SymbolTypeOfRegexp < T > >
static grammar::RightRG < SymbolType, unsigned > convert ( const T & regexp );
......
......@@ -12,8 +12,17 @@ namespace regexp {
 
namespace convert {
 
auto ToGrammarRightRGGlushkovUnboundedRegExp = registration::AbstractRegister < ToGrammarRightRGGlushkov, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToGrammarRightRGGlushkov::convert );
auto ToGrammarRightRGGlushkovFormalRegExp = registration::AbstractRegister < ToGrammarRightRGGlushkov, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToGrammarRightRGGlushkov::convert );
auto ToGrammarRightRGGlushkovUnboundedRegExp = registration::AbstractRegister < ToGrammarRightRGGlushkov, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::UnboundedRegExp < > & > ( ToGrammarRightRGGlushkov::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.\n\
\n\
@param regexp the regexp to convert\n\
@return right regular grammar generating the language described by the original regular expression" );
auto ToGrammarRightRGGlushkovFormalRegExp = registration::AbstractRegister < ToGrammarRightRGGlushkov, grammar::RightRG < DefaultSymbolType, ext::pair < DefaultSymbolType, unsigned > >, const regexp::FormalRegExp < > & > ( ToGrammarRightRGGlushkov::convert, "regexp" ).setDocumentation (
"Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.\n\
\n\
@param regexp the regexp to convert\n\
@return right regular grammar generating the language described by the original regular expression" );
 
} /* namespace convert */
 
......
......@@ -28,19 +28,19 @@ namespace regexp {
namespace convert {
 
/**
* Converts regular expression to right regular grammar using Glushkov algorithm.
* Converts regular expression to right regular grammar using Glushkov algorithm of neighbours.
* Source: None yet.
*/
class ToGrammarRightRGGlushkov {
public:
/**
* Performs conversion.
* Implements conversion of regular expressions to finite automata usign Glushkov's method of neighbours.
*
* \tparam SymbolType tye of symbols in the regular expression
* \tparam SymbolType the type of symbols in the regular expression
*
* \param regexp original regular expression
* \param regexp the regexp to convert
*
* \return right regular grammar equivalent to source regexp.
* \return right regular grammar generating the language described by the original regular expression
*/
template < class SymbolType >
static grammar::RightRG < SymbolType, ext::pair < SymbolType, unsigned > > convert(const regexp::FormalRegExp < SymbolType > & regexp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment