On Google code Georg Jaehnig has created a finite state machine library in Javascript called fsmjs. It covers the algorithm from the Mohri paper Weighted automata algorithms. The are demos of fsmjs here. I was playing around with it and wondered if I could compile it to the .net framework using the JScript.NET compiler, I made a few changes and got it to compile and run! The modified file is here.

To compile it at the Visual studio command prompt type 

jsc fsm.js

The default demo is will perform a star closure on toy machine and dump the results in dot format.

fsm.exe | dot –Tpdf > test.pdf

Will create a pdf of the machine.

The JScript.Net compiler doesn't seem to like globals so I can't currently compile it to a library,  but if it can be compiled to .net library  it should be possible to call it  from .net programs.

This entry was posted by Edobashira. Bookmark the permalink.