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.
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
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
> 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>