RE: [colorforth] forth taxonomy
- Subject: RE: [colorforth] forth taxonomy
- From: Samuel Falvo <falvosa@xxxxxxxxx>
- Date: Wed, 6 Aug 2003 21:44:30 -0700 (PDT)
> I'm curious how different Forths aproached this aspect. I'd
> like to implement meta-compilation in colorForth which does not seem
> obvious to me.
For my Forth, I treat meta-compilation as a special case of target compilation.
In short, I don't bother trying to "meta"-compile anything. I build a target
compiler which simply targets the host machine.
As far as actually how to write your meta-compiler, my approach is to write the
source for your Forth environment in the ideal dialect of Forth, then write the
appropriate words to make said source compile as you want it. Note: this will
almost certainly mean redefining words (e.g., HERE becomes HHERE [host's HERE],
etc).
NOTE: Since ColorForth uses a look-up table for dispatching to various word
handlers based on color, it should be easy to replace the default functionality
of the various colors by simply swapping out the handler addresses in the jump
table. Hence, it's actually much easier to write a target compiler in
ColorForth than for other Forth systems; just as you would have FORTH and MACRO
to switch the current vocabulary definitions go into, so you would have HOST
and TARGET (or some similar names) to swap in the appropriate color look-up
vectors.
If I've confused, I apologize. I'll try to explain further in you're
interested.
--
Samuel A. Falvo II
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com