Skip to content
/ jslex Public

Pure-javascript implementation of a FSM lexical analyzer

Notifications You must be signed in to change notification settings

dshafer/jslex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jslex

Not very long ago, I was surprised and troubled to find that there was apparently no ready-made solution to my pressing need to transform arbritray text into swedish chef dialect. This is a problem that the unix world addressed decades ago with a little bit of lex magic, but somehow, tragically, unforgivably, front-end developers haven't had easy access to this important tool.

Obviously, somebody needed to do something.

jslex is my answer to this problem. The design is informed somewhat by lex's input files, but I made no attempt at compatibility or feature-parity. Basically, the features that exist are those that I needed to be able to borkify text.

Usage

var translator = Translate.compile_translator(borkborkbork);
console.log(translator.translate('Welcome.'); // prints "Velcume-a.  Bork Bork Bork!"

See test_translate.html for a full example.

About

Pure-javascript implementation of a FSM lexical analyzer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published