streaming regular parser
streaming acceptor for regular languages
WORK IN PROGRESS
var r = require'regular-stream'and = rand start = rstar plus = rplusor = ror rmaybe = rmaybe empty = remptyand'A' 'B' star'C' //ABCCCCCCCCand'A' star'A' //A | AAAAAAplus'A' //same as ^starorA B //ABBABABABBABABABBBABAAandA orB empty C //AB?CandA maybeB C //ABC | AC
Each expression can also be drawn as state transition graphs. Would be cool to generate this automatically.
events must occur in order
and A B C* --> A --> B --> C
or A Bx ---> A ---> y\ /^\ /`-> B -`
star A&k ---> A ---> y\ /^`---------`
plus A&x ---> A --->y
maybe Ax ---> A --->y\ /^`--------`
And then we can draw a big graph, and show a program's execution path on it!
but maybe using canvas instead of ansi.