Namespace mata::nft::builder¶
-
namespace builder
Namespace providing options to build NFAs.
Functions
-
Nft create_single_word_nft(const WordName &word, Alphabet *alphabet = nullptr)
Create an automaton accepting only a single
word.
-
Nft create_empty_string_nft(size_t num_of_levels = DEFAULT_NUM_OF_LEVELS)
Create automaton accepting only epsilon string.
-
Nft create_sigma_star_nft(size_t num_of_levels = DEFAULT_NUM_OF_LEVELS)
Create automaton accepting sigma star over the passed alphabet using DONT_CARE symbol.
- Parameters:
num_of_levels – [in] Number of levels in the created NFT.
-
Nft create_sigma_star_nft(const Alphabet *alphabet = new OnTheFlyAlphabet{}, size_t num_of_levels = DEFAULT_NUM_OF_LEVELS)
Create automaton accepting sigma star over the passed alphabet.
- Parameters:
alphabet – [in] Alphabet to construct sigma star automaton with. When alphabet is left empty, the default empty alphabet is used, creating an automaton accepting only the empty string.
num_of_levels – [in] Number of levels in the created NFT.
-
Nft construct(const parser::ParsedSection &parsec, Alphabet *alphabet, NameStateMap *state_map = nullptr)
Loads an automaton from Parsed object.
-
Nft construct(const IntermediateAut &inter_aut, Alphabet *alphabet, NameStateMap *state_map = nullptr)
Loads an automaton from Parsed object.
-
void construct(Nft *result, const IntermediateAut &inter_aut, Alphabet *alphabet, NameStateMap *state_map = nullptr)
Loads an automaton from Parsed object; version for python binding.
-
template<class ParsedObject>
Nft construct(const ParsedObject &parsed, Alphabet *alphabet = nullptr, NameStateMap *state_map = nullptr)
-
Nft parse_from_mata(std::istream &nft_stream)
Parse NFA from the mata format in an input stream.
- Parameters:
nft_stream – Input stream containing NFA in mata format.
- Throws:
std::runtime_error – Parsing of NFA fails.
-
Nft parse_from_mata(const std::string &nft_in_mata)
Parse NFA from the mata format in a string.
- Parameters:
nft_in_mata – String containing NFA in mata format.
- Throws:
std::runtime_error – Parsing of NFA fails.
-
Nft parse_from_mata(const std::filesystem::path &nft_file)
Parse NFA from the mata format in a file.
-
Nft from_nfa_with_levels_zero(const nfa::Nfa &nfa, size_t num_of_levels = DEFAULT_NUM_OF_LEVELS, bool explicit_transitions = true, std::optional<Symbol> next_levels_symbol = {})
Create Nft from
nfawith specifiednum_of_levels.This function takes transition from
nfaas transitions between zero level and the first level of NFT. All transition between the remaining levels are created based on the function parameters:explicit_transitionsandnext_levels_symbol.- Parameters:
nfa – NFA to create NFT from.
num_of_levels – Number of levels of NFT.
explicit_transitions – If true, the transitions between levels are explicit (i.e., no jump transitions, except for the epsilon transitions over all levels).)
next_levels_symbol – If specified, it is used as a symbol on transitions after the first level. If not specified, the symbol of the transition is reused.
- Returns:
NFT representing
nfawithnum_of_levelsnumber of levels.
-
Nft from_nfa_with_levels_advancing(mata::nfa::Nfa nfa, size_t num_of_levels)
Creates Nft from
nfawith specifiednum_of_levelsautomatically.It assumes that
nfais a representation of an nft without jump transitions. It assign to each state the level based on the distance from the initial state. For example, if there are 2 levels, the initial states are level 0, the successor states are level 1, the states after that level 0, etc.If you only have one level, then it is more efficient to call the constructor that takes Nfa as input.
- Throws:
std::runtime_error – if some state should be assigned two different levels or if the final state is not at level 0.
-
Nft create_single_word_nft(const WordName &word, Alphabet *alphabet = nullptr)