DFA.hpp
A Deterministic Finite Automata simulator.
Note
Status: BETA
Typedefs
-
template<int NUM_SYMBOLS = 128, typename STOP_TYPE = uint8_t>
class tDFA - #include <DFA.hpp>
Public Functions
-
inline tDFA(size_t num_states = 0)
-
inline ~tDFA()
-
inline size_t GetSize() const
How many states is this DFA using?
-
inline void Resize(size_t new_size)
Add Additional empty states.
-
inline const array<int, NUM_SYMBOLS> &GetTransitions(size_t from) const
Return an array of all transitions associated with a specified state.
-
inline void SetTransition(size_t from, size_t to, size_t sym)
Add a specific transition associated with an input symbol.
-
inline void SetStop(size_t state, stop_t stop_val = 1)
Set the stop value (no matter what it currently is)
-
inline void AddStop(size_t state, stop_t stop_val = 1)
Set the stop value only if it’s higher than the current stop value.
-
inline bool IsActive(int state) const
Test if a state is still valid.
-
inline bool IsStop(int state) const
Test if a state has a stop.
-
inline bool IsActive(size_t) const
-
inline bool IsStop(size_t state) const
-
inline int Next(int state, size_t sym) const
Return the new state after a symbol occurs.
-
inline int Next(int state, std::string sym_set) const
Return the new state after a series of symbols.
Private Types
-
using this_t = tDFA<NUM_SYMBOLS, STOP_TYPE>
-
inline tDFA(size_t num_states = 0)