Sujet : Re: Juggling system-compilation items
De : peter.m.falth (at) *nospam* gmail.com (PMF)
Groupes : comp.lang.forthDate : 10. Aug 2024, 09:57:04
Autres entêtes
Organisation : novaBBS
Message-ID : <0ec1b5bb411c30d7598c4d5cae50fcdf@www.novabbs.com>
References : 1
User-Agent : Rocksolid Light
On Fri, 9 Aug 2024 14:05:47 +0000, Ruvim wrote:
Do you know a Forth system in which the following definition for "const"
is compiled but does not work as expected?
>
>
: const ( x "<spaces>name" -- )
depth >r ( x ) ( R: n.depth )
: ( x colon-sys ) ( R: n.depth )
depth r> - ( x colon-sys n.size ) ( R: )
n>r ( x ) ( R: i*x n.size )
postpone literal ( ) ( R: i*x n.size )
nr> ( colon-sys n.size ) ( R: )
drop ( colon-sys )
postpone ; ( )
;
>
>
t{ 123 const foo -> }t
t{ foo -> 3 }t
>
>
Note 3.1.5.1 System-compilation types
<https://forth-standard.org/standard/usage#subsubsection.3.1.5.1>
>
>
--
Ruvim
Yes if fails on both my systems lxf and lxf64!the reason if fails is that : stores the current depth and ; latercompares it with the actualat that point. This is to catch unmatched loops and conditionals.
The usual use of >r r> works as intended
: const >r : r> postpone literal postpone ; ;
I think !csp and ?csp are common also in other systems. I certainly did
not invent them.
BR
Peter