A generic finite state machine library.
This library provides two means of pattern matching: Knuth-Morris-Pratt (KMP; for the Iterator interface) and Boyer-Moore (BM; for the List interface) algorithm-based exact matchers (i.e., two DFAs) and a weighted backtracking-based pattern matcher using dynamic programming that provides Kleene closures (*
, +
, and ?
) and capture groups ((
... )
) for the matched patterns (i.e., a NFA). The entire library is implemented using generics (i.e., requires Java 1.5 and beyond), so that any sequence of types may be used (arrays, Lists and any sequence that provides the Iterator protocol). The APIs are implemented as close as possible to Java's own Pattern and Matcher APIs in util.regex
.
See the Java API index page of this library for general information, or the specific notes on using an ExactMatcher (a BM List matcher), the ExactScanner (a KMP Iterator scanner), and on implementing the NFA Pattern matcher. For an example of using the pattern matcher, refer to the txtfnnl
project to find examples of the Transition interface , the Pattern implementation , and an actual CFG pattern compiler .
Clone from github ( git clone git://github.com/fnl/libfsmg.git
), and run mvn install
in the newly created libfsmg
directory.
libfsmg is free, open source software provided via a Apache 2.0 License -see LICENSE.txt
in this directory for details.
Copyright 2012, 2013 - Florian Leitner (fnl). All rights reserved.