--- stevan apter <
sa@...> wrote:
> john cowan is doing a joy implementation in chicken scheme, which will
> adhere 100% to manfred's spec, but be easier to extend and (he hopes)
> faster.
FWIW, I toyed with a compiler (written in Haskell) for a Joy-like
language which targets Scheme (Chicken and DrScheme). You can see the
approach I have taken by grabbing a copy at...
http://sleepingsquirrel.org/almost/almost-joy.tar
...There's a large similarity between Joy and Scheme which makes writing
the compiler and primitives especially easy. I wonder if anyone has a
good comprehensive test suite of Joy programs, what with all the
different implementations floating around.
Greg Buchholz
From the Almost-Joy README...
Almost-Joy is similar to regular Joy, but with the restriction that
lists are separate from quoted programs. Quotations are introduced with
square brackets as normal. Lists are introduced with parenthesis. You
can't execute lists (i.e. applying the "i" combinator to a list is an
error) and you can't apply list oriented functions like "cons" and "map"
to quoted programs. Use the "comp" word to compose two quotations. And
you can't automatically reflect data items on the stack back into
quotations (although adding a word to do that operation wouldn't be
hard). I still havn't decided if separating lists and quotations is the
best idea. I could be convinced otherwise. Comments in the source are
not yet allowed.
The Almost-Joy compiler takes a (*.joy) file and creates a Scheme
program which can be compiled with the Chicken scheme compiler, or
executed under the DrScheme environment (should be portable to Bigloo
with minor modification to the "joy_header.scm" file). About 85% of the
functions in the Joy manual...
http://www.latrobe.edu.au/philosophy/phimvt/joy/plain-manual.html
...have been implemented in Almost-Joy. (Although some functions might
have Scheme semantics instead of Joy semantics). Here's an example of
the quadratic equation in Almost-Joy...
quadratic ==
[ ( [ pop pop 2 * ]
[ pop 0 swap - ]
[ swap dup * rollup * 4 * - sqrt ] )
[i] map ] ternary unlist
[ ( [ + swap / ]
[ - swap / ] )
[i] map ]
ternary ;
2 -4 -6 quadratic showstack
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs