Skip to content
/ fsajs Public

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

License

Notifications You must be signed in to change notification settings

fmmontas/fsajs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published