Newer
Older
#ifndef TO_REG_EXP_STATE_ELIMINATION_H_
#define TO_REG_EXP_STATE_ELIMINATION_H_
#include <regexp/RegExp.h>
#include <automaton/Automaton.h>
#include <automaton/FSM/DFA.h>
#include <automaton/FSM/NFA.h>
#include <automaton/FSM/MultiInitialStateNFA.h>
#include <automaton/FSM/EpsilonNFA.h>
#include <automaton/FSM/ExtendedNFA.h>
/**
* Converts FSM to RE using State Elimination algorithm.
* Source: Melichar 2.118
*/
class ToRegExpStateElimination : public std::SingleDispatch<ToRegExpStateElimination, regexp::RegExp, const automaton::AutomatonBase &> {
/**
* Performs conversion.
* @param automaton automaton to convert
* @return regular expression equivalent to source NFA.
*/
static regexp::RegExp convert(const automaton::Automaton& automaton);
template<class T>
static regexp::RegExp convert(const T& automaton);
static void extendExtendedNFA(automaton::ExtendedNFA& automaton);
static const regexp::RegExp transition(const automaton::ExtendedNFA& automaton, const label::Label& from, const label::Label& to);
static automaton::ExtendedNFA eliminateState(const automaton::ExtendedNFA& extendedAutomaton, const label::Label& state);