Skip to content
No description or website provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
notes.md
package.json

README.md

regular-stream

streaming acceptor for regular languages

[http://en.wikipedia.org/wiki/Regular_language]

WORK IN PROGRESS

var r = require('regular-stream')
  , and = r.and, start = r.star, plus = r.plus
  , or = r.or, r.maybe = r.maybe, empty = r.empty

and('A', 'B', star('C')) //ABCCCCCCCC

and('A', star('A'))      //A | AAAAAA

plus('A')               //same as ^

star(or(A, B)) //ABBABABABBABABABBBABAA

and(A, or(B, empty()), C) //AB?C

and(A, maybe(B), C) //ABC | AC

Graphs

Each expression can also be drawn as state transition graphs. Would be cool to generate this automatically.

and / cat

events must occur in order

and (A, B, C)

* --> A --> B --> C

or / union

or (A, B)
x ---> A ---> y
  \          /^
   \        /
    `-> B -`

star

star (A)
        &
k ---> A ---> y
 \           /^
  `---------`

plus

plus (A)
        &
x ---> A --->y

maybe

maybe (A)
x ---> 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.

License

MIT

Something went wrong with that request. Please try again.