Try to implement matz/streem as a DSL within Ruby with a little syntax sacrifice.
Try to implement matz/streem as a DSL within Ruby with a little syntax sacrifice.
All of this work are based on commit 8dba5e8.
For more information, please read my blog post RBSTREEM: A TOY IMPLEMENTATION OF STREEM LANG, OR, ON THE STUDY OF SO-CALLED PIPE-ORIENTED PROGRAMMING.
You have to build and install gem first:
$ gem build rbstreem.gemspec
$ gem install rbstreem-<some-version>.gem
Then you could evaluate RbStreem script by typing:
$ streem [path/to/run.strm.rb]*
NOTE: due to the require
method, a rb
suffix is need for a strm script file. A later release will fix this.
I will list the original papers and books, but I will also list the corresponding Chinese version.
[Abel83] introduced a interesting system propagation of constraints(约束传播) in section 3.3.5, which inspire me to develop the streem.rb. In the footnote of that page, we know that"this idea first appeared in the incredibly forward-looking SKETCHPAD system by Ivan Sutherland". Since constraints are equations in that system, which means the computation can be performed in two different direction, but streem.rb has a distinguish direction: from a source to a destination. And that system is nonpreemptive and signal sensitive, in other words, once some signal changes, all the equations have to re-computing to be balanced through the 'constraint chains', that why it be called 'propagation'. Thus, we will be stuck in a chain too long.
[Hoare85].
[Abel83] also encourages programmers implementing features as a DSL in a host language, so that you can get the power of the host language as an extension naturally. I think the syntax is not the most important matter now, so I ignore the syntax matter and just implement the streem.rb in Ruby using some fantastic Ruby tricks.
[Dan02] shows that a Linux/UNIX pipe is a/two file descriptor(s) shared between two processes(one for write, one for read) in chapter #17.
Matz himself developed a consuming passion in UNIX pipe, event-drive pattern(eventmachine), asynchronous IO, non-block IO and stream in [Matz12] by analyzing serveral programming languages and useful libraries. [Matz12] gives me a general idea of what the streem.rb should act like.