Kleene Runtime Integration

Finite State Machines (FSMs) are data structures (directed, labeled graphs) that don't really do anything by themselves. Runtime Code is a program, or more likely library of programs, that can read FSMs from file and “apply” them to input, returning the output. A larger application would ideally just import a pre-written Kleene Runtime Library to integrate finite-state processing. The Kleene GUI provides a test facility for simple hand-testing of FSMs, but there is currently no runtime-code library available to allow external applications to incorporate and apply the Kleene FSMs.

However, there is an experimental set of scripts (called fst2java) that take a Kleene FSM, saved to file in a special state-oriented XML format, and generate from that XML file a Java-language class definition that implements the FSM as executable code. Any Java (or Scala, Groovy, or Clojure, and perhaps JRuby and JPython) program can then import the generated class, instantiate a Java object that represents the original FSM, and call its various pre-defined “apply” methods.

fst2java is still not well tested. If it proves reliable, it will be integrated into the Kleene language and GUI.

The scripts for fst2java are available from the downloads page. Their use is documented in the Kleene User Manual.