-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
For:libraryThe issue is related to library (c++ implementation)The issue is related to library (c++ implementation)Module:nfaThe issue is related to Nondeterministic Finite AutomataThe issue is related to Nondeterministic Finite AutomataType:suggestionA suggestion for feature/change that is not necessary at this momentA suggestion for feature/change that is not necessary at this moment
Description
If an Nfa has some alphabet, it would also be nice to be able to write something like aut.delta.add(2, "my_symbol", 3) instead of aut.delta.add(2, aut.alphabet->translate_symb("my_symbol"), 3). However, this would require delta to also store the alphabet. An alternative would be to have a function aut.delta_add, but this would make things inconsistent.
By @bruderjakob17 in #584.
Options:
- We should add
template <typename SymbolName>Nfa::add_transition(State source, SymbolName symbol, State target, Alphabet* alphabet = nullptr)which calls the member alphabetthis->alphabet->translate_symbol(symbol), unless the parameteralphabetis notnullptrat which point this alphabet instance is preferred.
This is consistent with theNft::add_transition()which is the more high-level approach to adding complex automata-level transitions, disregarding the technical details of the Mata implementation of the transition relation. - The only question is whether this should be more explicitly named, something like
Nfa::add_transition_with_symbol_name()(and however shorter this can be made) to distinguish from the same high-level approach, but without the alphabet. - Alternatively, the template is not even necessary, and we will just use a
std::string. I think onlyNfa::add_transtiion(..., Symbol, ...)andNfa::add_transition(..., SymbolName symbol_name, ...)would be sufficient.
Metadata
Metadata
Assignees
Labels
For:libraryThe issue is related to library (c++ implementation)The issue is related to library (c++ implementation)Module:nfaThe issue is related to Nondeterministic Finite AutomataThe issue is related to Nondeterministic Finite AutomataType:suggestionA suggestion for feature/change that is not necessary at this momentA suggestion for feature/change that is not necessary at this moment