Deutsch   English   Français   Italiano  
<nnd$31a1f742$034b7241@9e9a7b1afb9694c4>

View for Bookmarking (what is this?)
Look up another Usenet article

Newsgroups: comp.lang.forth
References: <a1aab44ee3b1b56c2f54f2606e98d040@www.novabbs.com> <66b2e541$1@news.ausics.net> <nnd$0f5b958e$48df9417@ef3cd4e41c521e2e> <87le18rurj.fsf@nightsong.com>
From: albert@spenarnc.xs4all.nl
Subject: Re: VALUE and TO implementation
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$31a1f742$034b7241@9e9a7b1afb9694c4>
Organization: KPN B.V.
Date: Thu, 08 Aug 2024 11:25:51 +0200
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.swapon.de!news.mixmin.net!feed.abavia.com!abe004.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 38
Injection-Date: Thu, 08 Aug 2024 11:25:51 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
Bytes: 2451

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 the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring.            - the Wise from Antrim -