On Thu, 7 Jul 2016 12:48:58 -0700 (PDT)
Alex Dowad <
alexin...@gmail.com> wrote:
> I'm sure there is a wealth of information on this topic out there on
> the web, but my Google power may not be strong enough. If anyone
> could be so kind as to give me a few links to quality material, that
> would be appreciated.
I'm probably not going to be able to help you that much. However, I
have questions the answers to which may help others to help you.
> I've built a Forth implementation and am interested in getting it to
> compile Forth programs to standalone binaries.
Are these binaries to have a built-in ITC or DTC interpreter, or
are they without an interpreter as STC? (answered below)
> Better yet is if only the word definitions which are actually needed
> go into the output.
So, you're wanting to specify a Forth word to use as a stand-alone
program, have that word's code traced all the way down to primitives,
and have the correct sequence of primitives emitted as binary code?
> Better still is if the output is fully relocatable and thus can be
> linked freely with libraries (which might be written in a different
> language). It turns out this is non-trivial to do, unless you make
> some undesirable compromises:
So, you're not wanting a built-in Forth address interpreter for ITC/DTC
code, but you're actually wanting compiled code like a C compiler
produces? (This would be STC in Forth parlance.)
You might consider going the Forth-to-C translation method and then
compile the C code. There are a couple of standalone programs which do
this.
Isn't there a Forth word like SEE to trace words? Can't you
redefine : colon and ; semicol to emit info, binary code, or C code?
And, can you add a bit, like for immediacy, to indicate a word trace
instead of interpretation or compilation?
Rod Pemberton