Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

And Bruce is effectively building BruceIX -- Alan Cox


devel / comp.lang.forth / vocabulary with VFX forth

SubjectAuthor
* vocabulary with VFX forthemmanuel
`* Re: vocabulary with VFX forthRuvim
 +* Re: vocabulary with VFX forthemmanuel
 |`- Re: vocabulary with VFX forthHugh Aguilar
 `- Re: vocabulary with VFX forthdxforth

1
vocabulary with VFX forth

<89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14450&group=comp.lang.forth#14450

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7761:: with SMTP id h1mr2556840qtu.272.1630583244942;
Thu, 02 Sep 2021 04:47:24 -0700 (PDT)
X-Received: by 2002:a0c:d6c4:: with SMTP id l4mr2502987qvi.3.1630583244697;
Thu, 02 Sep 2021 04:47:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Sep 2021 04:47:24 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=128.141.161.81; posting-account=EfelLwoAAABNZLetwUX-gYx-7MjLwaQV
NNTP-Posting-Host: 128.141.161.81
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>
Subject: vocabulary with VFX forth
From: emmanuel...@cern.ch (emmanuel)
Injection-Date: Thu, 02 Sep 2021 11:47:24 +0000
Content-Type: text/plain; charset="UTF-8"
 by: emmanuel - Thu, 2 Sep 2021 11:47 UTC

Dear all ,

I would like to play with the vocabulary under VFX forth (windows version).

I do the same under gforth and it's ok why ?

cheers
Emmanuel

In fact, I have an error like this :

vocs
WINCONSTANTS BNF-VOC EXTERN.VOC TYPES DISASSEMBLER H-C ASM-ACCESS ASM-CORE LOCALGEN LOCALARGS
COMPILATION? LOCALVARS LICENSED EXTERNALS SUBSTITUTIONS SOURCEFILES ENVIRONMENT SYSTEM ROOT
FORTH
ok
vocabulary myvocabulary ok
myvocabulary definitions ok
: hello ." hello from my myvocabulary" ;
Err# -13 ERR: Undefined word.
-> : hello ." hello from my myvocabulary" ;
^

Re: vocabulary with VFX forth

<sgqgsb$c0h$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14452&group=comp.lang.forth#14452

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: vocabulary with VFX forth
Date: Thu, 2 Sep 2021 15:42:49 +0300
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <sgqgsb$c0h$1@dont-email.me>
References: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 2 Sep 2021 12:42:52 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="d6e479f385a70476d510465f320c1374";
logging-data="12305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1LHzZZQslKYxQWiVM3ms5"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:F1l50w1NdfXw3Cimk988oxbTHyU=
In-Reply-To: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>
Content-Language: en-US
 by: Ruvim - Thu, 2 Sep 2021 12:42 UTC

On 2021-09-02 14:47, emmanuel wrote:
> Dear all ,
>
> I would like to play with the vocabulary under VFX forth (windows version).
>
> I do the same under gforth and it's ok why ?
>

>
> In fact, I have an error like this :
>
>
> vocs
> WINCONSTANTS BNF-VOC EXTERN.VOC TYPES DISASSEMBLER H-C ASM-ACCESS ASM-CORE LOCALGEN LOCALARGS
> COMPILATION? LOCALVARS LICENSED EXTERNALS SUBSTITUTIONS SOURCEFILES ENVIRONMENT SYSTEM ROOT
> FORTH
> ok
> vocabulary myvocabulary ok
> myvocabulary definitions ok
> : hello ." hello from my myvocabulary" ;
> Err# -13 ERR: Undefined word.
> -> : hello ." hello from my myvocabulary" ;
> ^
>

"myvocabulary" is a vocabulary. When a vocabulary is performed, it
*replaces* the top word list in the search order.
See also:
<https://forth-standard.org/proposals/vocabulary?hideDiff#reply-453>

So, the "myvocabulary" word has the following effects:

myvocabulary ( -- ) ( O: i*wid wid0 -- i*wid wid-myvocabulary )

Where "O:" identifies the search order stack.

If the search order is ( O: wid-forth ), then after "myvocabulary" is
performed the search order is ( O: wid-myvocablulary ).
And nothing can be found anymore.

It's your case in VFX.

In Gforth the initial search order is:

( O: wid-root wid-forth wid-forth )

and after "myvocabulary" it is:

( O: wid-root wid-forth wid-myvocabulary )

So your code works in Gforth.

But in the general case you cannot assume that the initial search order
contains anything except FORTH-WORDLIST

So, your code should be:

vocabulary myvocabulary
also myvocabulary definitions

where
also ( O: wid -- wid wid )

--
Ruvim

Re: vocabulary with VFX forth

<a521a50b-acae-4fb8-8a61-d7ed4f00715dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14453&group=comp.lang.forth#14453

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:6106:: with SMTP id a6mr1082438qtm.246.1630587286373;
Thu, 02 Sep 2021 05:54:46 -0700 (PDT)
X-Received: by 2002:a05:6214:1cb:: with SMTP id c11mr2900030qvt.47.1630587286168;
Thu, 02 Sep 2021 05:54:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Sep 2021 05:54:46 -0700 (PDT)
In-Reply-To: <sgqgsb$c0h$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=128.141.161.81; posting-account=EfelLwoAAABNZLetwUX-gYx-7MjLwaQV
NNTP-Posting-Host: 128.141.161.81
References: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com> <sgqgsb$c0h$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a521a50b-acae-4fb8-8a61-d7ed4f00715dn@googlegroups.com>
Subject: Re: vocabulary with VFX forth
From: emmanuel...@cern.ch (emmanuel)
Injection-Date: Thu, 02 Sep 2021 12:54:46 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 83
 by: emmanuel - Thu, 2 Sep 2021 12:54 UTC

Le jeudi 2 septembre 2021 à 14:42:54 UTC+2, Ruvim a écrit :
> On 2021-09-02 14:47, emmanuel wrote:
> > Dear all ,
> >
> > I would like to play with the vocabulary under VFX forth (windows version).
> >
> > I do the same under gforth and it's ok why ?
> >
>
> >
> > In fact, I have an error like this :
> >
> >
> > vocs
> > WINCONSTANTS BNF-VOC EXTERN.VOC TYPES DISASSEMBLER H-C ASM-ACCESS ASM-CORE LOCALGEN LOCALARGS
> > COMPILATION? LOCALVARS LICENSED EXTERNALS SUBSTITUTIONS SOURCEFILES ENVIRONMENT SYSTEM ROOT
> > FORTH
> > ok
> > vocabulary myvocabulary ok
> > myvocabulary definitions ok
> > : hello ." hello from my myvocabulary" ;
> > Err# -13 ERR: Undefined word.
> > -> : hello ." hello from my myvocabulary" ;
> > ^
> >
> "myvocabulary" is a vocabulary. When a vocabulary is performed, it
> *replaces* the top word list in the search order.
> See also:
> <https://forth-standard.org/proposals/vocabulary?hideDiff#reply-453>
>
> So, the "myvocabulary" word has the following effects:
>
> myvocabulary ( -- ) ( O: i*wid wid0 -- i*wid wid-myvocabulary )
>
> Where "O:" identifies the search order stack.
>
> If the search order is ( O: wid-forth ), then after "myvocabulary" is
> performed the search order is ( O: wid-myvocablulary ).
> And nothing can be found anymore.
>
> It's your case in VFX.
>
> In Gforth the initial search order is:
>
> ( O: wid-root wid-forth wid-forth )
>
> and after "myvocabulary" it is:
>
> ( O: wid-root wid-forth wid-myvocabulary )
>
> So your code works in Gforth.
>
> But in the general case you cannot assume that the initial search order
> contains anything except FORTH-WORDLIST
>
>
> So, your code should be:
>
> vocabulary myvocabulary
> also myvocabulary definitions
>
> where
> also ( O: wid -- wid wid )
>
>
>
> --
> Ruvim

Great ! :)

thank's a lot

Emmanuel

Re: vocabulary with VFX forth

<sgrla0$6c6$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14464&group=comp.lang.forth#14464

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: vocabulary with VFX forth
Date: Fri, 3 Sep 2021 09:04:32 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sgrla0$6c6$1@gioia.aioe.org>
References: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>
<sgqgsb$c0h$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="6534"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 2 Sep 2021 23:04 UTC

On 2/09/2021 22:42, Ruvim wrote:
>
> But in the general case you cannot assume that the initial search order
> contains anything except FORTH-WORDLIST

Alas, how complicated we humans have made Forth (and everything else).

Re: vocabulary with VFX forth

<0282f01c-4900-4517-a43e-ad137d16390bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14465&group=comp.lang.forth#14465

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:aaf:: with SMTP id ew15mr983994qvb.14.1630632233784;
Thu, 02 Sep 2021 18:23:53 -0700 (PDT)
X-Received: by 2002:ac8:7d0d:: with SMTP id g13mr1373316qtb.367.1630632233535;
Thu, 02 Sep 2021 18:23:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Sep 2021 18:23:53 -0700 (PDT)
In-Reply-To: <a521a50b-acae-4fb8-8a61-d7ed4f00715dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.174.192.66; posting-account=OxDKOgoAAADW0cxAqHqpN1zqeCoSsDap
NNTP-Posting-Host: 98.174.192.66
References: <89b8118f-b8bd-4917-a2fd-c6d8c771e5e5n@googlegroups.com>
<sgqgsb$c0h$1@dont-email.me> <a521a50b-acae-4fb8-8a61-d7ed4f00715dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0282f01c-4900-4517-a43e-ad137d16390bn@googlegroups.com>
Subject: Re: vocabulary with VFX forth
From: hughagui...@gmail.com (Hugh Aguilar)
Injection-Date: Fri, 03 Sep 2021 01:23:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 283
 by: Hugh Aguilar - Fri, 3 Sep 2021 01:23 UTC

On Thursday, September 2, 2021 at 5:54:47 AM UTC-7, emmanuel wrote:
> Le jeudi 2 septembre 2021 à 14:42:54 UTC+2, Ruvim a écrit :
> > But in the general case you cannot assume that the initial search order
> > contains anything except FORTH-WORDLIST
> >
> >
> > So, your code should be:
> >
> > vocabulary myvocabulary
> > also myvocabulary definitions
> >
> > where
> > also ( O: wid -- wid wid )
> >
> > Ruvim
> Great ! :)
>
> thank's a lot

Here is code that brings ANS-Forth up to the level of Forth-83 (see the
SET-CONTEXT word that does what storing a vocno into CONTEXT did
in Forth-83). There are other features provided. This is from my novice package.
----------------------------------------------------------------------------------------------------------------
\ ******
\ ****** Some word-list stuff.
\ ******

: set-forth ( -- ) \ sets default configuration
only forth definitions ;

: <get-context> ( -- wid ) \ like CONTEXT @ in Forth-83 (ANS-Forth already provides GET-CURRENT)
get-order dup 1 < abort" *** GET-CONTEXT given empty search-order ***"
over >r \ r: -- top-wid
0 do drop loop \ --
r> ;

: <push-context> { wid -- }
get-order
wid swap 1+ \ put WID on top of whatever is there
set-order ;

\ <PUSH-CONTEXT> always pushes WID, even if WID is already the 1st. It has to be consistent in always pushing, so <POP-CONTEXT> can pop what was pushed.

: <pop-context> ( -- wid ) \ undo PUSH-CONTEXT and return the wid
get-order dup 1 < abort" *** POP-CONTEXT given empty search-order ***"
swap >r 1-
set-order
r> ;

: <drop-context> ( -- )
<pop-context> drop ;

\ <GET-CONTEXT> <PUSH-CONTEXT> <POP-CONTEXT> and <DROP-CONTEXT> don't take into consideration LOCALVARS# being in the way.

\ VFX pushes a wid called LOCALVARS onto the search order in colon words that have locals, then pops it off again at the semicolon.
\ It is in the way. If you set the 1st value to a replacement wid, you will replace LOCALVARS rather than the wid you thought you were replacing (which is now 2nd).
\ This is a gross violation of the ANS-Forth standard (13.3.3-1):
\ "...if the Search-Order word set is present, local identifiers shall always be searched before any of the word lists in any definable search order,
\ and none of the Search-Order words shall change the locals’ privileged position in the search order."

\ Note: Stephan Pelc fixed the bug mentioned above in version 4.71.3523 of Oct.8,2014.

\ The following definition of SET-CONTEXT works around the bug in VFX, and will also work in Forths that don't have the bug.

false value localvars# \ this is the wid that is 1st in the search-order inside of colon words that have local variables
marker temporary
false value expected# \ this is the wid that we are expecting to be 1st

: fill-localvars# ( -- ) \ this fills <LOCALVARS> at compile-time for use by <SET-CONTEXT> --- it doesn't do anything at run-time
true abort" *** FILL-LOCALVARS# is not to be run, it fills LOCALVARS# at compile-time ***"
[ <get-context> to expected# ]
1 2 3 locals| x y z |
[
<get-context> expected# <> [if]
<pop-context> to localvars#
<get-context> expected# <> [if] .( *** FILL-LOCALVARS# can't find EXPECTED# ***) abort [then]
localvars# <push-context> [then]
] ;

\ FILL-LOCALVARS# doesn't have to run --- it fills LOCALVARS# at compile-time.
temporary \ discard this code that fills LOCALVARS# at compile-time --- it is never needed again

: push-underneath { wid -- } \ push WID underneath whatever is 1st so WID becomes 2nd, leaving 1st as 1st
<pop-context> \ hold 1st
<get-context> wid <> if
wid <push-context> then \ don't push WID on top of itself (if WID was 2nd originally)
<push-context> ; \ push 1st back on top

: replace-1st ( wid -- )
push-underneath <drop-context> ; \ use PUSH-UNDERNEATH so WID is not duplicated if it already 2nd

: <set-context> { wid anchor -- }
<get-context> anchor = if \ if ANCHOR is 1st
wid anchor = if exit then \ WID is already 1st, so we are done
wid <push-context> \ push WID on top of ANCHOR, rather than replace ANCHOR
exit then
<get-context> localvars# = if \ if LOCALVARS# is 1st
<pop-context> \ -- localvars#
<get-context> anchor = if \ if ANCHOR is 2nd
wid <push-context> \ push WID on top of ANCHOR, rather than replace ANCHOR
else
wid replace-1st then \ else, replace 2nd with WID
<push-context> \ restore LOCALVARS# as 1st
exit then
wid replace-1st ; \ 1st was neither ANCHOR nor LOCALSVAR#, so we just replace 1st with WID (now GET-CONTEXT will give us WID)

: set-context ( wid -- )
forth-wordlist <set-context> ;

\ FORTH-WORDLIST SET-CONTEXT would do the same thing that FORTH does.

\ The following PUSH-CONTEXT POP-CONTEXT and DROP-CONTEXT take into account LOCALVARS#.
\ Use xxx PUSH-CONTEXT rather than ALSO xxx SET-CONTEXT because everything goes haywire if the ANCHOR is the 1st wid.
\ All in all, ALSO is a screw-ball idea because it involves making a duplicate on the search-order, which makes no sense.
\ Forth is supposed to be context-free, but ALSO only makes sense when it is followed by SET-CONTEXT (but not when the anchor is 1st).
\ In this 1993 comp.lang.forth thread: https://groups.google.com/forum/#!topic/comp.lang.forth/olO-VHXJa1Q
\ Ray Duncan (who sold UR/Forth back then), described ONLY/ALSO as "severely brain-damaged."
\ Apparently he had zero influence over ANS-Forth design though, because he gave up on Forth after ANS-Forth came out in 1994.

: get-context ( -- wid )
<get-context> \ -- 1st
dup localvars# = if drop \ --
<pop-context> <get-context> \ -- 1st 2nd
swap <push-context> then ; \ -- 2nd

: definitions ( -- ) \ the VFX version of DEFINITIONS has a bug in that it doesn't take LOCALVARS into consideration
get-context set-current ;

: push-context { wid -- }
<get-context> localvars# = if
<pop-context> wid <push-context> \ -- 1st
<push-context> \ --
else
wid <push-context> then ;

: pop-context ( -- wid ) \ undo PUSH-CONTEXT and return the wid
<pop-context> \ -- 1st
dup localvars# = if
<pop-context> \ -- 1st 2nd
swap <push-context> then ; \ -- 2nd

: drop-context ( -- )
pop-context drop ;

char & comment \ this is for testing the word-list stuff

wordlist constant test1# \ used only by TEST that follows
wordlist constant test2# \ used only by TEST that follows

: test ( -- ) \ this tests SET-CONTEXT
[ cr .( TEST1# = ) test1# u. ]
[ cr .( TEST2# = ) test2# u. ]
[ cr .( FORTH-WORDLIST = ) forth-wordlist u. ]
[ set-forth order ]
[ get-context cr .( context = ) u. order ]
[ forth-wordlist set-context order ]
[ test1# set-context order ]
1 2 3 locals| x y z | [ order ]
[ get-context cr .( context = ) u. order ]
[ test1# push-context order ]
[ drop-context order ]
[ test1# set-context order ]
[ test2# set-context order ]
[ test1# push-context order ]
[ drop-context order ]
;

order
set-forth

: test-forth ( -- ) \ this tests FORTH that is supposed to be the same as FORTH-WORDLIST SET-CONTEXT
[ set-forth cr .( test-forth) order ]
[ forth order ]
1 2 3 locals| x y z | [ order ]
[ forth order ] \ this fails under VFX
;


Click here to read the complete article
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor