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

user documentation of automata run algos

parent 496bd348
No related branches found
No related tags found
1 merge request!55Dev
......@@ -12,16 +12,75 @@ namespace automaton {
 
namespace run {
 
auto AcceptDFALinearString = registration::AbstractRegister < Accept, bool, const automaton::DFA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptNFALinearString = registration::AbstractRegister < Accept, bool, const automaton::NFA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptEpsilonNFALinearString = registration::AbstractRegister < Accept, bool, const automaton::EpsilonNFA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptDFTARankedTree = registration::AbstractRegister < Accept, bool, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Accept::accept );
auto AcceptNFTARankedTree = registration::AbstractRegister < Accept, bool, const automaton::NFTA < > &, const tree::RankedTree < > & > ( Accept::accept );
auto AcceptInputDrivenDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptVisiblyPushdownDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::DPDA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptNPDTALinearString = registration::AbstractRegister < Accept, bool, const automaton::NPDTA < > &, const string::LinearString < > & > ( Accept::accept );
auto AcceptDFALinearString = registration::AbstractRegister < Accept, bool, const automaton::DFA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptNFALinearString = registration::AbstractRegister < Accept, bool, const automaton::NFA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptEpsilonNFALinearString = registration::AbstractRegister < Accept, bool, const automaton::EpsilonNFA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptDFTARankedTree = registration::AbstractRegister < Accept, bool, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Accept::accept, "automaton", "tree" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptNFTARankedTree = registration::AbstractRegister < Accept, bool, const automaton::NFTA < > &, const tree::RankedTree < > & > ( Accept::accept, "automaton", "tree" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptInputDrivenDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptVisiblyPushdownDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptDPDALinearString = registration::AbstractRegister < Accept, bool, const automaton::DPDA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
auto AcceptNPDTALinearString = registration::AbstractRegister < Accept, bool, const automaton::NPDTA < > &, const string::LinearString < > & > ( Accept::accept, "automaton", "string" ).setDocumentation (
"Automaton run implementation resulting in boolean true if the automaton accepted the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return true if the automaton accepts given string" );
 
} /* namespace run */
 
......
......@@ -12,12 +12,47 @@ namespace automaton {
 
namespace run {
 
auto OccurrencesDFALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DFA < > &, const string::LinearString < > & > ( Occurrences::occurrences );
auto OccurrencesDFTARankedTree = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Occurrences::occurrences );
auto OccurrencesInputDrivenDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences );
auto OccurrencesVisiblyPushdownDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences );
auto OccurrencesRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences );
auto OccurrencesDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences );
auto OccurrencesDFALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DFA < > &, const string::LinearString < > & > ( Occurrences::occurrences, "automaton", "string" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
auto OccurrencesDFTARankedTree = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Occurrences::occurrences, "automaton", "tree" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
auto OccurrencesInputDrivenDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences, "automaton", "string" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
auto OccurrencesVisiblyPushdownDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences, "automaton", "string" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
auto OccurrencesRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences, "automaton", "string" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
auto OccurrencesDPDALinearString = registration::AbstractRegister < Occurrences, ext::set < unsigned >, const automaton::DPDA < > &, const string::LinearString < > & > ( Occurrences::occurrences, "automaton", "string" ).setDocumentation (
"Automaton occurrences run implementation.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of indexes to the string where the automaton passed a final state" );
 
} /* namespace run */
 
......
......@@ -12,19 +12,96 @@ namespace automaton {
 
namespace run {
 
auto ResultDFALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFA < > &, const string::LinearString < > & > ( Result::result );
auto ResultDFTARankedTree = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Result::result );
auto ResultInputDrivenDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Result::result );
auto ResultVisiblyPushdownDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Result::result );
auto ResultRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Result::result );
auto ResultDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::DPDA < > &, const string::LinearString < > & > ( Result::result );
auto ResultDFALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result );
auto ResultDFTARankedTree2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFTA < > &, const tree::RankedTree < > &, const DefaultStateType & > ( Result::result );
auto ResultInputDrivenDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::InputDrivenDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result );
auto ResultVisiblyPushdownDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result );
auto ResultRealTimeHeightDeterministicDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result );
auto ResultDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result );
auto ResultDFALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFA < > &, const string::LinearString < > & > ( Result::result, "automaton", "string" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultDFTARankedTree = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFTA < > &, const tree::RankedTree < > & > ( Result::result, "automaton", "tree" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultInputDrivenDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::InputDrivenDPDA < > &, const string::LinearString < > & > ( Result::result, "automaton", "string" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultVisiblyPushdownDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > & > ( Result::result, "automaton", "string" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultRealTimeHeightDeterministicDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > & > ( Result::result, "automaton", "string" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultDPDALinearString = registration::AbstractRegister < Result, DefaultStateType, const automaton::DPDA < > &, const string::LinearString < > & > ( Result::result, "automaton", "string" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return state where the run stopped" );
auto ResultDFALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result, "automaton", "string", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
auto ResultDFTARankedTree2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DFTA < > &, const tree::RankedTree < > &, const DefaultStateType & > ( Result::result, "automaton", "tree", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
auto ResultInputDrivenDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::InputDrivenDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result, "automaton", "string", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
auto ResultVisiblyPushdownDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::VisiblyPushdownDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result, "automaton", "string", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
auto ResultRealTimeHeightDeterministicDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::RealTimeHeightDeterministicDPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result, "automaton", "string", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
auto ResultDPDALinearString2 = registration::AbstractRegister < Result, DefaultStateType, const automaton::DPDA < > &, const string::LinearString < > &, const DefaultStateType & > ( Result::result, "automaton", "string", "fail" ).setDocumentation (
"General automaton run implementation resulting in the reached state. Generic fail state is returned if the automaton's transition function was not defined for the input.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@param fail the state to use when transition function is not defined for the input\n\
@return state where the run stopped" );
 
} /* namespace run */
 
......
/*
* Translate.cpp
*
* Created on: 12. 5. 2016
* Author: Jakub Doupal
*/
#include "Translate.h"
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace run {
auto TranslateNPDTALinearString = registration::AbstractRegister < Translate, ext::set < string::LinearString < > >, const automaton::NPDTA < > &, const string::LinearString < > & > ( Translate::translate );
} /* namespace run */
} /* namespace automaton */
/*
* Translate.cpp
*
* Created on: 12. 5. 2016
* Author: Jakub Doupal
*/
#include "Translate.h"
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace run {
auto TranslateNPDTALinearString = registration::AbstractRegister < Translate, ext::set < string::LinearString < > >, const automaton::NPDTA < > &, const string::LinearString < > & > ( Translate::translate, "automaton", "string" ).setDocumentation (
"Implementation of a run of an automaton that is producing output.\n\
\n\
@param automaton the runned automaton\n\
@param string the input of the automaton\n\
@return set of strings representing the translations" );
} /* namespace run */
} /* namespace automaton */
/*
* Translate.h
*
* Created on: 12. 5. 2016
* Author: Jakub Doupal
*/
#ifndef _AUTOMATON_TRANSLATE_H__
#define _AUTOMATON_TRANSLATE_H__
#include <string/LinearString.h>
#include "Run.h"
#include <automaton/PDA/NPDTA.h>
#include <alib/deque>
#include <alib/set>
namespace automaton {
namespace run {
/**
* \brief
* Implementation of transducer run over its input.
*/
class Translate {
public:
/**
* \override
*
* \tparam InputSymbolType type of input symbols of the string and terminal symbols of the runned automaton
* \tparam OutputSymbolType type of output symbols of the runned automaton
* \tparam EpsilonType type of epsilon in the runned automaton
* \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton
* \tparam StateType type of states of the runned automaton
*
* \param automaton the runned automaton
* \param string the input of the automaton
*
* \return set of strings representing the translations
*/
template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType >
static ext::set < string::LinearString < OutputSymbolType > > translate ( const automaton::NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string );
};
template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType >
ext::set < string::LinearString < OutputSymbolType > > Translate::translate ( const automaton::NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ) {
ext::tuple < bool, ext::set < StateType >, ext::set < ext::vector < OutputSymbolType > > > res = Run::calculateStates ( automaton, string );
ext::set < string::LinearString < OutputSymbolType > > strings;
for ( const auto & rawString : std::get < 2 > ( res ) )
strings . insert ( string::LinearString < OutputSymbolType > ( rawString ) );
return strings;
}
} /* namespace run */
} /* namespace automaton */
#endif /* _AUTOMATON_TRANSLATE_H__ */
/*
* Translate.h
*
* Created on: 12. 5. 2016
* Author: Jakub Doupal
*/
#ifndef _AUTOMATON_TRANSLATE_H__
#define _AUTOMATON_TRANSLATE_H__
#include <string/LinearString.h>
#include "Run.h"
#include <automaton/PDA/NPDTA.h>
#include <alib/deque>
#include <alib/set>
namespace automaton {
namespace run {
/**
* \brief
* Implementation of transducer run over its input.
*/
class Translate {
public:
/**
* Implementation of a run of an automaton that is producing output.
*
* \tparam InputSymbolType type of input symbols of the string and terminal symbols of the runned automaton
* \tparam OutputSymbolType type of output symbols of the runned automaton
* \tparam EpsilonType type of epsilon in the runned automaton
* \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton
* \tparam StateType type of states of the runned automaton
*
* \param automaton the runned automaton
* \param string the input of the automaton
*
* \return set of strings representing the translations
*/
template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType >
static ext::set < string::LinearString < OutputSymbolType > > translate ( const automaton::NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string );
};
template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType >
ext::set < string::LinearString < OutputSymbolType > > Translate::translate ( const automaton::NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ) {
ext::tuple < bool, ext::set < StateType >, ext::set < ext::vector < OutputSymbolType > > > res = Run::calculateStates ( automaton, string );
ext::set < string::LinearString < OutputSymbolType > > strings;
for ( const auto & rawString : std::get < 2 > ( res ) )
strings . insert ( string::LinearString < OutputSymbolType > ( rawString ) );
return strings;
}
} /* namespace run */
} /* namespace automaton */
#endif /* _AUTOMATON_TRANSLATE_H__ */
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