Skip to content

Arsenic-ATG/Finite-Automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finite Automata

A simple C++ library to simulate finite automata.

The library mostly operates upon a object of class finite_automata which is by definition a 5 tuple (Q, Σ, δ, q0, F)

  1. Q = finite set of states the automata can operate on.
  2. Σ = Finte set of input aphabet symbols
  3. δ = transition functions ( )
  4. q0 = initial state
  5. F = finite set of final states

one can create an object of type finite_automata like this :

auto nfa_transitions = (fa::transition_table) { {{1,'a'},{1}} ,
                                                {{1,'b'},{2}} ,
                                                {{2,'a'},{2,1}} ,
                                                {{2,'b'},{3}} ,
                                                {{3,'a'},{3}} ,
                                                {{3,'b'},{3}}};

  auto nfa = fa::finite_automata ({1,2,3},
                                  {'a','b'},
                                  {3},
                                  1,
                                  nfa_transitions);

learn more about the API in the docs.

Prerequisites ( to build from source )

How to use it ?

  1. Go to src/ diectory.
  2. Run make install to build the static library in ./binaries.
  3. for any query/bug report, feel free to open an issue regarding the same.

Examples

check out this example which demonstrates the use of fa::convert_to_dfa () to convert an NFA to corresponding DFA.

For the Devs

[WIP]

License

MIT License Copyright 2022 © Ankur Saini