NAME
FLAT::NFA - Nondeterministic finite automata
SYNOPSIS
A FLAT::NFA object is a finite automata whose transitions are labeled either with characters or the empty string (epsilon).
USAGE
In addition to implementing the interface specified in FLAT, FLAT::NFA objects provide the following NFA-specific methods:
- $nfa->epsilon_closure(@states)
-
Returns the set of states (without duplicates) which are reachable from @states via zero or more epsilon-labeled transitions.
- $nfa->trace($string)
-
Returns a list of N+1 arrayrefs, where N is the length of $string. The I-th arrayref contains the states which are reachable from the starting state(s) of $nfa after reading I characters of $string. Correctly accounts for epsilon transitions.
- $nfa->as_undirected
-
Outputs FA in a format that may be easily read into an external program as a description of an undirected graph.
- $nfa->as_digraph
-
Outputs FA in a format that may be easily read into an external program as a description of an directed graph.
- $nfa->as_gdl
-
Outputs FA in Graph Description Language (GDL), including directed transitions with symbols and state names labeled.
- $nfa->as_graphviz
-
Outputs FA in Graphviz format, including directed transitions with symbols and and state names labeled. This output may be directly piped into any of the Graphviz layout programs, and in turn one may output an image using a single commandline instruction.
fash
uses this function to implement its "nfa2gv" command:fash nfa2gv "a*b" | dot -Tpng > nfa.png
- $nfa->as_undirected_graphviz
-
Outputs FA in Graphviz format, with out the directed transitions or labels. The output is suitable for any of the Graphvize layout programs, as discussed above.
- $nfa->as_summary
-
Outputs a summary of the FA, including its states, symbols, and transition matrix. It is useful for manually validating what the FA looks like.
AUTHORS & ACKNOWLEDGEMENTS
FLAT is written by Mike Rosulek <mike at mikero dot com> and Brett Estrade <estradb at gmail dot com>.
The initial version (FLAT::Legacy) by Brett Estrade was work towards an MS thesis at the University of Southern Mississippi.
Please visit the Wiki at http://www.0x743.com/flat
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.