fsajs

0.0.21 • Public • Published

fsajs

Library for creating finite state automata and testing if they accept a given string.

fsajs = require('fsajs').fsajs # import the module

fsa = fsajs.createFSA() # configure fsa
	.addState 
	  name: 'pepe' 
	  transitions:[{stateName:'other', symbol:'c'},{stateName:'otherState', symbol:'b'}]
	  initialState: true
	.addState 
	  name: 'otherState', 
	  transitions:[{stateName:'other', symbol:'c'},{stateName:'otherState', symbol:'b'}], 
	  finalState: true
	.addState 
	  name: 'other', 
	  transitions:[{stateName:'pepe', symbol:'c'},{stateName:'otherState', symbol:'b'}] 

fsa.acceptsString 'bcccb' # returns true 

fsa.acceptsString 'bccbb' # returns false 

Readme

Keywords

Package Sidebar

Install

npm i fsajs

Weekly Downloads

3

Version

0.0.21

License

MIT

Last publish

Collaborators

  • fmont006