I've been experimenting with implementing a language spec for Gash, such that you can use the shell from the Guile REPL:
scheme@(guile-user)> ,language gash
Happy hacking with Guile as Shell! To switch back, type `,L scheme'.
gash@(guile-user)> find .
$1 = 0
gash@(guile-user)> find foo
find: 'foo': No such file or directory
$2 = 1
To achieve this as a simple evaluated language is straightforward:
(define-module (language gash spec)
#:use-module (gash parser)
#:use-module (gash eval)
#:use-module (gash environment)
#:use-module (system base language)
#:title "Guile as Shell"
#:reader (lambda (port env) (read-sh port))
#:evaluator (lambda (x module) (eval-sh x) (get-status))
I'm wondering if there would be any interest in including something like this in Gash?
also not difficult to naively compile to tree-il, but I think the way
I've done it would not be what is wanted, since it really just compiles
the *interpreter* `eval-sh` code. Of course, `eval-sh` examines an
_expression_ of Gash tokens, producing bits of Scheme code and immediately
evaluating them; a proper compiler should replace the Gash token stream
with those same Scheme _expression_ sequences without executing them, and
pass that to the tree-il compiler. However, that's beyond the scope of
my current familiarity with the Gash implementation.
Happy hacking with Guile as Shell!