Sujet : Re: VALUE and TO implementation
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 08. Aug 2024, 10:25:51
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$31a1f742$034b7241@9e9a7b1afb9694c4>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
87le18rurj.fsf@nightsong.com>,
Paul Rubin <
no.email@nospam.invalid> wrote:
albert@spenarnc.xs4all.nl writes:
Numbers (also denotations, such as strings) must be smart.
>
I've thought of having non-smart numbers in a small Forth. Instead of
123 you would say # 123 or something similar, where # is a parsing word
that emits LIT and the number. I remember that the eForth metacompiler
does something like that, to handle the case where the host and target
processors have differing number representations (e.g. word sizes).
I don't think that would count as non-smart numbers.
A long time ago I demonstrated handling denotations (numbers)
in INTERPRET . Reminder denotations are constant and the same
in either mode.
It requires that there is a separate compilation stack.
As soon as INTERPRET detects that a word (obviously immediate)
leaves something on the stack, and it is in compilation state,
it compiles one or more literals.
That is in the context of PREFIXes. 0x is a prefix immediate.
0x1234 gets control and generates hex 1234 . INTERPRET takes
cares of the rest.
Bottom line, that is the single location in the whole Forth
where STATE is inspected.
In ciforth I don't go that far, but all denotations ends in a
call to LITERAL/DLITERAL which comes close.
Groetjes Albert
>
-- Don't praise the day before the evening. One swallow doesn't make spring.You must not say "hey" before you have crossed the bridge. Don't sell thehide of the bear until you shot it. Better one bird in the hand than ten inthe air. First gain is a cat purring. - the Wise from Antrim -