Skip to content

eug/cuckoo

Repository files navigation

cuckoo Build Status

A simple and easy-to-use framework for creating automatons..

  • Descriptive declarations
  • Finite, Pushdown and Turing machine support.
  • Implemented with breadth-first search for evaluate the tree of possibilities

Build

The *.jar file will be created at dist directory.

ant -f build.xml

TL;DR docs

State classes

  • FState: Finite State
  • PState: Pushdown State
  • TState: Turing machine State

Runner classes

  • DFARunner: Deterministic Finite Automaton
  • NFARunner: Non-Deterministic Finite Automaton
  • DPDARunner: Deterministic Pushdown Automaton
  • NPDARunner: Non-Deterministic Pushdown Automaton
  • DTMRunner : Deterministic Turing Machine

Examples

For further understanding take a look at examples tree.

A simple Deterministic Finite Automaton


cuckoo

  1. Define your states.
 FState q0 = new FState("q0");
 FState q1 = new FState("q1");
  1. Define your transitions.
 q0.trans().when("1").goTo(q0);
 q0.trans().when("0").goTo(q1);
 q1.trans().when("1").when("0").goTo(q1);
  1. Create your test words.
 Word word = new Word("111110000");
  1. Compute your string
 DFARunner runner = new DFARunner(word, q0);
 runner.compute();
  1. Do whatever you want with the result
System.out.println(runner.getResult().getState());

TODO

  • DFA minimization?
  • NFA to DFA conversion?
  • More examples!