VSH and GRASH

29 views
Skip to first unread message

Paul Tarvydas

unread,
Mar 7, 2012, 11:25:26 AM3/7/12
to flow-based-...@googlegroups.com
FYI - yesterday at the TLUG (Toronto Lisp Users Group) meeting, I showed my code for a - currently very raw - toolchain that I call VSH (visual shell) and GRASH (graph shell), which is intended to replace the *nix shell with FBP.

This was inspired by Henri's talk (a question at the end mentioned yEd) and the constant reminders in this forum that SH is FBP.

The toolchain is thus:

yEd is used to make drawings of boxes (FBP components). Ports are drawn as circles that intersect the bounaries of the boxes. yEd's arrow connectors connect ports to other ports.

The graphml file representing yEd's drawing is parsed by Common Lisp (xmls library) to extract info re. boxes, circles, positions and edge sources and targets.

This is output as a set of prolog assertions.

SWI prolog is used to infer intersection of circles on boxes. (This is actually overkill, but consistent with my wish to use multiple languages).

This is output in GRASH "assembler" format which is interpreted by a simple C program[*]. Here is a sample of a grash script:

# First Light test
# effectively: echo hello | cat -

pipe 0

fork
dupout 0
exec echo hello
krof

fork
dupin 0
exec cat -
krof

(i.e. declare a pipe #0, fork, dup, exec "echo", fork, dup, exec "cat")

All or these are trivial bits of code written in one weekend (it took longer to remember how to use fork and dup than to write everything else).

The intention is to allow for arbitrary graphs of pipes, later augmented with sockets, url's, whatever.

The intention is to show how stunningly easy all of this is.

I'll stick it on github after a bit more work a few weekends from now.

pt

[*] The output step from prolog to grash is still MIA, but the grash shell itself works.

Sam Watkins

unread,
Mar 8, 2012, 8:56:05 PM3/8/12
to flow-based-...@googlegroups.com
Paul Tarvydas wrote:
> FYI - yesterday at the TLUG (Toronto Lisp Users Group) meeting, I showed my code for a - currently very raw - toolchain that I call VSH (visual shell) and GRASH (graph shell), which is intended to replace the *nix shell with FBP.

hi Paul,

This sounds interesting. Using a full operating system like UNIX for
FBP can be a good approach: tools can be written in any language, it can
take advantage of multi-processors and distribution, process crashes are
isolated, and you can use existing tools. I'll like to see it, when
you're ready for a first preview release.

I've often wanted a more flexible notation for composing tools in shell
scripts.

Most of my own thinking is about using FBP at the 'micro' level, for
that it might not be practical to have an OS process for each component.
But for many practical programming tasks, I think an OS process for each
component can work very well.


Sam

Paul Tarvydas

unread,
Mar 26, 2012, 12:04:56 PM3/26/12
to flow-based-...@googlegroups.com
Progress Report:

First light!

Vsh self-compiles and runs.

9 components (lisp) plus the grash interpreter (C). Line counts:

105 io.lisp
95 scan.lisp
24 check-input.lisp
20 calc-bounds.lisp
37 mark-directions.lisp
55 match-ports-to-components.lisp
41 assign-pipe-numbers-to-inputs.lisp
54 assign-pipe-numbers-to-outputs.lisp
57 assign-fds.lisp
78 emit-grash.lisp
251 ../grash/grash.c
817 total

At present, it is not "production ready", but it is a working proof of concept.

I need to tidy up the directory structure and figure out how to use git-hub and what license to attach. Advice would be most welcome.

Diagram attached.

pt

vsh.png

John Cowan

unread,
Mar 26, 2012, 2:19:44 PM3/26/12
to flow-based-...@googlegroups.com
Paul Tarvydas scripsit:

> I need to tidy up the directory structure and figure out how to use
> git-hub and what license to attach. Advice would be most welcome.

I recommend that you use my license wizard at
http://www.ccil.org/~cowan/floss .

--
Ambassador Trentino: I've said enough. I'm a man of few words.
Rufus T. Firefly: I'm a man of one word: scram!
--Duck Soup John Cowan <co...@ccil.org>

Paul Tarvydas

unread,
Apr 29, 2012, 4:00:15 PM4/29/12
to flow-based-...@googlegroups.com
OK, after too much "life gets in the way", I think I've posted vsh and grash (visual FBP-like shell on top of linux) to github at:

https://github.com/guitarvydas/vsh

I consider this to be in a "toy" state. It comes with only one example (itself).

FBP'ers should be able to see what's going on and whether there are any ideas worth extending or stealing. It's probably not ready to be shown to non-FBP'ers (I'm tired of hearing "it's too simple, hence, cannot be useful" :-).

This version is done mostly in SBCL, and grash is done in gcc.

I was toying with doing a parallel implementation of the 9 components in C, but my time is too fragmented at present (and I don't relish learning how to parse XML with C :-).

(If Common Lisp is a barrier to anyone who is truly interested, I would be glad to give a "reading" in English of any parts that are considered obtuse).

Comments, suggestions, and help are welcome.

pt

Paul Tarvydas

unread,
Apr 29, 2012, 4:01:03 PM4/29/12
to flow-based-...@googlegroups.com
The next step is, probably, to add error handling, which leads to the question: do I add numbered pipes, named pipes or sockets next?

And then it leads to the question: how does one do a "reset" bus in FBP?

I see the answer in the EE way - when one component anywhere in the chain detects an error, all components receive a RESET signal.

To do it exactly this way requires that one output port can deliver to many input ports (something JPM doesn't agree with, iirc).

Maybe there's a different FBP paradigm for reset?

pt
Reply all
Reply to author
Forward
0 new messages