Tue, 18 Nov 1997 16:18:41 +0000
At 18:44 17/11/97 -0500, firstname.lastname@example.org (Mike Rilee) wrote:
>Would it be reasonable to use ANS Forth as a portable
>back end for a lisp system? What would the advantages
>and disadvantages be?
I've thought about this myself. After writing a Lisp to Forth compiler,
you could compile the compiler itself, change the backend so that
it generates code directly (machine code, threaded code, whatever).
Forth's compiler is open enough so that the compiler can be called
from portable Forth code, so this could make the above Lisp compiler
as portable as standard Forth.
I don't have a more recent ANSI Forth reference than DPANS94, but this
should certainly work with the earlier standards, like Forth 83, providing you
can extend them to work around word length dependancies (Forth 83 defined
a cell as 16bit.)
>Would there be any advantages to using a Forth vs. a
>C based backend? Forth might very well be easier
>to work with and have fewer legacies to deal with.
I'd expect continuations to be with Forth easier than if you were compiling
to C. I'm assuming that the code will either be threaded, or that you can
pull the return address off the return stack and place it in a continuation,
then later push it back onto the return stack and EXIT. The Forth stack is
a lot easier to manipulate than the C stack.
If you want to run LispOS as a bootable OS, it might help to have a
language like Forth at the lowest level (Didn't Sun do something like this,
with OpenBoot?), if only for bootstrapping the Lisp compiler. Once running,
the compiler could compile Lisp to native code. Perhaps a Forth assembler
could help, too?
I like the idea of using Forth in this way, but I'm not sure that this is
necessarily the best way for a LispOS. It may depend on how everyone
here feels about Forth. How many of us have used Forth?
After using Forth for many years, and writing several Forth systems, I can
say that I'm comfortable with it. On the other hand, I don't use it as much as
I used to...Forth lead me to Lisp, so I still have a fondness for it. However,
that's not a good enough reason for building LispOS on Forth.
Or is it? Discuss. ;)
<URL:http://www.wildcard.demon.co.uk> You can never browse enough
Future generations are relying on us
It's a world we've made - Incubus
We're living on a knife edge, looking for the ground -- Hawkwind