Sujet : Re: FP number syntax
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 04. Jan 2025, 17:09:43
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$230b364e$0dc8505c@dcdf037aa1ea8bec>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
2025Jan3.170018@mips.complang.tuwien.ac.at>,
Anton Ertl <
anton@mips.complang.tuwien.ac.at> wrote:
albert@spenarnc.xs4all.nl writes:
One step further is to use 0x for hex values, and free $ for
environment strings.
>
Forth systems can use 0x as hex prefix already, and in 2007 I checked
several systems <http://www.forth200x.org/number-prefixes.html>: PFE,
Gforth 0.6.9, Win32Forth (4.x and 6.x), and VFX Forth understood 0x10
as well as 0X10; iForth, bigForth, SwiftForth, and lxf did not.
>
Someone would need to make a proposal for making the $ prefix for hex
numbers obsolescent as a first step towards destandardization.
Meanwhile, Gforth has a recognizer for environment variables:
>
${HOME} type
>
prints "/home/anton".
In ciforth
WANT $-PREFIX
adds `` # $ 0x '' to the minimal search order, because they define
numbers.
{ ONLY WORDS PREVIOUS } EXECUTE
' & ^ 0 1 2 3 4 5 6 7 8 9 A B C
D E F - + " FORTH $ 0x # OK
^ ^ ^
The temporary executable thingy is needed, because after `ONLY , `WORDS
is not found. `PREVIOUS restores this.
A word "GET-ENV" is in order, e.g.
"HOME" GET-ENV TYPE
/home/albert OK
Now defining $ is easy, but it is preferable to get rid of the $ word first.
'$ HIDDEN
OK
: $ NAME GET-ENV ; PREFIX
OK
$HOME TYPE
/home/albert OK
Or your proposed syntax:
: ${ &} PARSE GET-ENV ; PREFIX
${HOME} TYPE
/home/albert OK
These words land in the CURRENT wordlist not in `ONLY :
WORDS
ONLY ENVIRONMENT NOOP ....
.... ENV0 SHIFT-ARGS (MENV) GET-ENV ${
OK ^
>
- anton
Groetjes Albert
-- Temu exploits Christians: (Disclaimer, only 10 apostles)Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style WallArt For Home, Office And Garden Decor - Perfect For Windows, Bars,And Gifts For Friends Family And Colleagues.