Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Helmar <helmwo@xxxxxxxxx>
- Date: Thu, 19 Mar 2009 09:48:54 -0700 (PDT)
On Mar 19, 12:28 pm, Jeff Fox <f...@xxxxxxxxxxxxxxxxxxx> wrote:
On Mar 19, 8:24 am, Helmar <hel...@xxxxxxxxx> wrote:
Forth doesn't have macros. It
has much more.
I could ask now "what is a macro"? Forth does not know it that way,
but you could implement it if you want (that would be an EVALUATE
basically). Forth is flexible and that is it. Even the people that use
Forth are usually flexible (and that I like), even if some are very
much like a stone if they are proposed to move ;)
Grüße,
-Helmar
For almost thirty years Chuck Moore has used two wordlists to
simplify the compiler and language; forth and macro. Macros
execute at compile time like immediate words did thirty years
ago.
So now we also know what color a macro has: it has to be yellow.
<colorforth explanation>
No. In Chuck's colorforth green is more like "]" and yellow is
more like "["
They do something more like change the system's STATE to execute
or compile. However macros are searched first in compile mode
and macros actually execute at compile time.
Thus one can have a green or yellow DUP but IF is compile only
because it is a macro.
Both DUP and IF are defined in the color red which is like ":"
"IF" is a macro so it has to be green not yellow!
Chuck uses cyan to specify that macro is to be compiled and
executed later rather than green which says execute it now
in compile mode.
So macros are defined in red and used in green or cyan but
can never be yellow! That would fail.
The words "forth" and "macro" declare some time before red
defines a new word to say whether the word will have the
"macro" behavior similar to the concept of immediate words
in Forth from fourty years ago.
In addition to the traditional Forth concepts of compile-
time and run-time colorforth uses the idea of edit-time
execution words specified by the color blue. Wil Baden
used standard Forth macros invoked by the editor to
do something similar.
<\colorforth explanation>
So I can not see at first place, what is a macro or not? That's
probably a little bit unfortunate. I did not dig too deep into
ColorForth, the only thing I know is that it uses colors to specify
system behaviours - as "what to do with a word". My memories told me
that "yellow" means execution, not compilation, what would be the best
description of what an "immediate" word or "macro" does.
What I'm now curious is what you mean by "edit-time". What does it
affect? Is it something like Ctrl-K ! in joe?
Regards,
-Helmar
.
- Follow-Ups:
- References:
- Is Forth still interesting?
- From: Helmar
- Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: Richard Owlett
- Re: Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: John Passaniti
- Re: Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: rios . lucho
- Re: Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: John Passaniti
- Re: Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: Jecel
- Re: Of course it IS!!! - was once wimpily (Re: Is Forth still interesting?)
- From: John Passaniti
- Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Anton Ertl
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Helmar
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Jeff M.
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Helmar
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Jeff Fox
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Helmar
- Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- From: Jeff Fox
- Is Forth still interesting?
- Prev by Date: Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- Next by Date: Re: Bull***! - Re: Zero operand CPUs
- Previous by thread: Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- Next by thread: Re: Open stack and colon definitions as a features (was: Of course it IS!!!)
- Index(es):
Loading