CBMC
nfat< T > Struct Template Reference

Very simple NFA implementation Not super performant, but should be good enough for our purposes. More...

#include <nfa.h>

+ Inheritance diagram for nfat< T >:
+ Collaboration diagram for nfat< T >:

Classes

struct  statet
 A state is a set of possibly active transitions. More...
 
struct  transitiont
 

Public Types

using state_labelt = std::size_t
 

Public Member Functions

 nfat ()=default
 
void add_transition (state_labelt from, T when, state_labelt to)
 Add a transition from "from" to "to" exactly when "when" is consumed. More...
 
void add_arbitrary_transition (state_labelt from, state_labelt to)
 Add a transition from "from" to "to" when any input is consumed This is handled a special case so not all inputs need to be enumerated for arbitrary transitions. More...
 
void add_epsilon_transition (state_labelt from, state_labelt to)
 Add a transition from "from" to "to" that doesn’t consume input. More...
 
statet initial_state (state_labelt initial) const
 
statet next_state (const statet &current, const T &input) const
 
void dump_automaton_dot_to (std::ostream &out) const
 Write the automaton structure to out in graphviz dot format. More...
 

Private Member Functions

void resize_if_necessary (state_labelt from, state_labelt to)
 
void follow_epsilon_transitions (statet &state) const
 

Private Attributes

std::vector< transitionttransitions
 

Detailed Description

template<typename T>
struct nfat< T >

Very simple NFA implementation Not super performant, but should be good enough for our purposes.

Definition at line 27 of file nfa.h.

Member Typedef Documentation

◆ state_labelt

template<typename T >
using nfat< T >::state_labelt = std::size_t

Definition at line 29 of file nfa.h.

Constructor & Destructor Documentation

◆ nfat()

template<typename T >
nfat< T >::nfat ( )
default

Member Function Documentation

◆ add_arbitrary_transition()

template<typename T >
void nfat< T >::add_arbitrary_transition ( state_labelt  from,
state_labelt  to 
)
inline

Add a transition from "from" to "to" when any input is consumed This is handled a special case so not all inputs need to be enumerated for arbitrary transitions.

Definition at line 59 of file nfa.h.

◆ add_epsilon_transition()

template<typename T >
void nfat< T >::add_epsilon_transition ( state_labelt  from,
state_labelt  to 
)
inline

Add a transition from "from" to "to" that doesn’t consume input.

Definition at line 66 of file nfa.h.

◆ add_transition()

template<typename T >
void nfat< T >::add_transition ( state_labelt  from,
when,
state_labelt  to 
)
inline

Add a transition from "from" to "to" exactly when "when" is consumed.

Definition at line 50 of file nfa.h.

◆ dump_automaton_dot_to()

template<typename T >
void nfat< T >::dump_automaton_dot_to ( std::ostream &  out) const
inline

Write the automaton structure to out in graphviz dot format.

Meant for debugging.

Definition at line 105 of file nfa.h.

◆ follow_epsilon_transitions()

template<typename T >
void nfat< T >::follow_epsilon_transitions ( statet state) const
inlineprivate

Definition at line 141 of file nfa.h.

◆ initial_state()

template<typename T >
statet nfat< T >::initial_state ( state_labelt  initial) const
inline

Definition at line 72 of file nfa.h.

◆ next_state()

template<typename T >
statet nfat< T >::next_state ( const statet current,
const T &  input 
) const
inline

Definition at line 80 of file nfa.h.

◆ resize_if_necessary()

template<typename T >
void nfat< T >::resize_if_necessary ( state_labelt  from,
state_labelt  to 
)
inlineprivate

Definition at line 132 of file nfa.h.

Member Data Documentation

◆ transitions

template<typename T >
std::vector<transitiont> nfat< T >::transitions
private

Definition at line 171 of file nfa.h.


The documentation for this struct was generated from the following file: