Discussion:
The holy 10 words of FORTH
(too old to reply)
Helmar Wodtke
2019-04-08 17:20:41 UTC
Permalink
DUP
DROP
SWAP
OVER
+
*
-
:
;
VALUE

And the last one, ... (we do not want to discuss)

-Helmar
m***@arcor.de
2019-04-08 18:37:44 UTC
Permalink
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
plonk
j***@gmail.com
2019-04-08 18:46:53 UTC
Permalink
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
Not holy - but Bernd's Minimum Word Set https://wiki.forth-ev.de/lib/exe/fetch.php/words:kernel_embedded:bernd_paysan_min_forth_english.pdf
Helmar Wodtke
2019-04-09 15:39:14 UTC
Permalink
Post by j***@gmail.com
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
Not holy - but Bernd's Minimum Word Set https://wiki.forth-ev.de/lib/exe/fetch.php/words:kernel_embedded:bernd_paysan_min_forth_english.pdf
Mhm, I know Bernds words. But it's not about minimum technical needs - it's about Forth's holy words. If it would be most simplicity - well take https://wiki.forth-ev.de/lib/exe/fetch.php/en:projects:a-start-with-forth:3_instruction_forth.pdf .
I described FOeRTHchen https://github.com/crcx/foerthchen as a "non-nonsense subset of FORTH". That means basically, that you can use it from scratch to do something.

Regards,
-Helmar
NN
2019-04-08 21:55:21 UTC
Permalink
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
What's the criteria ? I cant see a common link
Helmar Wodtke
2019-04-09 14:51:35 UTC
Permalink
Post by NN
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
What's the criteria ? I cant see a common link
It's about holy words. 10 for reasons. The first words is what I start with implementing a stack. You need this for Forth. Then you need "operations" (not "operators"). There you have "+", "*" <- very needed things. Instead of "-" I could have selected "NEGATE", but well, "-" is in more common use. Now only two words left before the 10th one. So it's obvious to have ":" and ";". Everything else is to discuss - even how words that divide work. "VALUE" we need urgently.

Regards,
-Helmar
Cecil - k5nwa
2019-04-09 17:53:46 UTC
Permalink
Post by Helmar Wodtke
Post by NN
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
What's the criteria ? I cant see a common link
It's about holy words. 10 for reasons. The first words is what I start with implementing a stack. You need this for Forth. Then you need "operations" (not "operators"). There you have "+", "*" <- very needed things. Instead of "-" I could have selected "NEGATE", but well, "-" is in more common use. Now only two words left before the 10th one. So it's obvious to have ":" and ";". Everything else is to discuss - even how words that divide work. "VALUE" we need urgently.
Regards,
-Helmar
Interesting discussion, how small can Forth be and still be able to
create a functional Forth out of it. Three Word Forth, is basically a
loader not really a Forth but with 10 words one could get there and
build a Forth System but it would be slow, still on a new CPU its a way
to get to a full system. Has anyone built a working Forth system with
these 10 words?

The smallest primitive word set I worked with lately was 32 words in C,
then it got expanded to 64 word C primitives, and now I'm thinking of
expanding it to 128 C primitives all strictly because of a minor
increase in performance. And since C is fairly portable if one restrict
themselves on library use it works out too as C is generally available
for every CPU out there.
--
Cecil - k5nwa
g***@gmail.com
2019-04-12 13:53:29 UTC
Permalink
Post by Cecil - k5nwa
Post by Helmar Wodtke
Post by NN
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
What's the criteria ? I cant see a common link
It's about holy words. 10 for reasons. The first words is what I start with implementing a stack. You need this for Forth. Then you need "operations" (not "operators"). There you have "+", "*" <- very needed things. Instead of "-" I could have selected "NEGATE", but well, "-" is in more common use. Now only two words left before the 10th one. So it's obvious to have ":" and ";". Everything else is to discuss - even how words that divide work. "VALUE" we need urgently.
Regards,
-Helmar
Interesting discussion, how small can Forth be and still be able to
create a functional Forth out of it. Three Word Forth, is basically a
loader not really a Forth but with 10 words one could get there and
build a Forth System but it would be slow, still on a new CPU its a way
to get to a full system. Has anyone built a working Forth system with
these 10 words?
The smallest primitive word set I worked with lately was 32 words in C,
then it got expanded to 64 word C primitives, and now I'm thinking of
expanding it to 128 C primitives all strictly because of a minor
increase in performance. And since C is fairly portable if one restrict
themselves on library use it works out too as C is generally available
for every CPU out there.
Care to share with us what the 32 words were? Also what words were added to the 64 word set?
--
Rick C.

- Get a 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209
Helmar Wodtke
2019-04-15 10:20:54 UTC
Permalink
Post by Cecil - k5nwa
Post by Helmar Wodtke
Post by NN
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
-Helmar
What's the criteria ? I cant see a common link
It's about holy words. 10 for reasons. The first words is what I start with implementing a stack. You need this for Forth. Then you need "operations" (not "operators"). There you have "+", "*" <- very needed things. Instead of "-" I could have selected "NEGATE", but well, "-" is in more common use. Now only two words left before the 10th one. So it's obvious to have ":" and ";". Everything else is to discuss - even how words that divide work. "VALUE" we need urgently.
Regards,
-Helmar
Interesting discussion, how small can Forth be and still be able to
create a functional Forth out of it.
For "functional" you need one word more at least to make conditionals. That would be for me "0;" or ANS-sequence "?DUP 0= IF EXIT THEN". Also some assumptions about what is on stack should be done... Also defined words should be able to call itself (avoiding "RECURSE"). Beside this, you can do with the 10 holy words a lot of things. It's more like a one run, one result thing, but by having two defining words (well, by changing scope compared to ANS, you get more power), it can do things like a tabular calculator for one cell (here we should have something that divides to make it more comfortable). Well, this subset is not about programming "Doom" or such.
Post by Cecil - k5nwa
Three Word Forth, is basically a
loader not really a Forth but with 10 words one could get there and
build a Forth System but it would be slow, still on a new CPU its a way
to get to a full system. Has anyone built a working Forth system with
these 10 words?
I could make you one. Say in some throw-away-language like Perl. It's not complicated. You could also restrict a causual Forth to have only these 10 words.
Post by Cecil - k5nwa
The smallest primitive word set I worked with lately was 32 words in C,
then it got expanded to 64 word C primitives, and now I'm thinking of
expanding it to 128 C primitives all strictly because of a minor
increase in performance. And since C is fairly portable if one restrict
themselves on library use it works out too as C is generally available
for every CPU out there.
You know FOerTHchen, noticed somewhere else in the thread? This is also not about the absolut minimum. But that's more practical to program something useful.
A problem about "minimalism" is, what and why you want it?
That 10 words are useful for something. They are not "that needed minimal set". It's more about spirit of the language and takes out things that are under discussion.

Regards,
-Helmar
m***@iae.nl
2019-04-09 18:04:16 UTC
Permalink
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
Code that doesn't use the first four words
would still be Forth, and probably be better.
And why VALUE instead of CREATE or DOES> ( , ' EXECUTE )?
Let me try:

@ ! , C, : ; '
CREATE DOES> EXECUTE [ ]
EMIT KEY
BEGIN UNTIL

Ok, 16 :-)

-marcel

-marcel

-marcel
m***@iae.nl
2019-04-09 18:05:30 UTC
Permalink
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
Code that doesn't use the first four words
would still be Forth, and probably be better.
And why VALUE instead of CREATE or DOES> ( , ' EXECUTE )?
Let me try:

@ ! , C, : ; '
CREATE DOES> EXECUTE [ ]
EMIT KEY
BEGIN UNTIL

Ok, 16 :-)

-marcel
b***@gmail.com
2019-04-12 12:56:15 UTC
Permalink
Post by m***@iae.nl
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
Code that doesn't use the first four words
would still be Forth, and probably be better.
And why VALUE instead of CREATE or DOES> ( , ' EXECUTE )?
@ ! , C, : ; '
CREATE DOES> EXECUTE [ ]
EMIT KEY
BEGIN UNTIL
Ok, 16 :-)
That's 10, with the right choice of ``BASE''.
Rod Pemberton
2019-06-01 02:54:43 UTC
Permalink
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?


What about R> and >R ?

What about @ and ! ?

What about CREATE ?

What about . and , and ' ?

What about [ and ] ?

What about : and ; ?

What about HERE and DP and LIT ?

etc.


Rod Pemberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
Mark Wills
2019-06-05 13:15:26 UTC
Permalink
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
What about R> and >R ?
What about CREATE ?
What about . and , and ' ?
What about [ and ] ?
What about : and ; ?
What about HERE and DP and LIT ?
etc.
Rod Pemberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
This issue has been studied over the years quite a lot. 10 seems to be a
very arbitrary number. You cannot buld a working system with only 10
words. Where's BRANCH? To be Turing complete, you need 0BRANCH too.

Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.

They note: "First, from a professional standpoint for those developing
critical controls, having a small system footprint that can be fully
verified and validated is beneficial. The workload in knowing you have
a good basis from which to springboard the application is reasonably
simple as it will not take a long time to perform certification confirmation
efforts. You can only certify from a known surface (surfaces are the interface
between lower level and upper level words)." (ibid.).

Here's the list they came up with (note: there's a couple of non-standardised
words in the list):

A Proposed minimal word set (Knaggs & Bennett, 2015).

1 Memory Access
6.1.0010 ! store
6.1.0150 , comma
6.1.0650 @ fetch
6.1.0705 ALIGN
6.1.0706 ALIGNED
6.1.0880 CELL+ cell-plus
6.1.0890 CELLS
6.1.0850 C! c-store
6.1.0860 C, c-comma
6.1.0870 C@ c-fetch
CALIGN c-allign
CALIGNED c-alligned
6.1.0897 CHAR+ char-plus
6.1.0898 CHARS chars

2 Arithmetic
6.1.0120 + plus
6.1.0090 * star
6.1.0320 2* two-star
6.1.0110 */MOD star-slash-mod
6.1.0160 - minus
6.1.0230 / slash
6.1.0330 2/ two-slash
6.1.1890 MOD

3 Logic
6.1.0270 0= zero-equals
6.1.0480 < less-than
6.1.0720 AND
6.1.1720 INVERT
6.2.2298 TRUE
6.1.1805 LSHIFT l-shift
6.1.0530 = equals
6.1.0540 > greater-than
6.1.1980 OR
6.1.2490 XOR x-or
6.2.1485 FALSE
6.1.2162 RSHIFT r-shift

4 Stack
6.1.1290 DUP dupe
6.1.2260 SWAP
6.1.0580 >R to-r
6.1.2070 R@ r-fetch
6.1.1260 DROP
6.1.1990 OVER
6.1.2060 R> r-from
6.1.2160 ROT rote

5 Flow Control
6.1.1700 IF
6.1.2270 THEN
6.1.2430 WHILE
6.1.2140 REPEAT
6.1.1240 DO
6.1.1680 I
6.1.0070 ' tick
6.1.1310 ELSE
6.1.0760 BEGIN
6.2.0700 AGAIN
6.1.2390 UNTIL
6.1.1800 LOOP
6.1.1730 J
6.1.1370 EXECUTE

6 Defnitions
6.1.0450 : colon
6.1.0950 CONSTANT
6.1.1000 CREATE
6.1.0460 ; semicolon
6.1.2410 VARIABLE
6.1.1250 DOES> does

7 Device
6.1.1750 KEY
6.1.1320 EMIT
10.6.1.1755 KEY? key-question
6.1.0990 CR c-r

8 Tools
6.1.0080 ( paren
15.6.1.0220 .S dot-s

-------------
Knaggs, P., Bennett, P. 2015. 'Minimal Forth'. EuroForth conference proceedings,
24th Septemeber, 2015.
Charles Childers
2019-06-05 14:49:23 UTC
Permalink
Post by Mark Wills
To be Turing complete, you need 0BRANCH too.
I don't have a 0BRANCH (or any other conditional jumps) in my Forth, but
it is Turing complete. (I do have a conditional call, but this is used
as an optimization only; it's perfectly feasible to avoid using it).

My conditionals and loops are built around quotations and the main
conditionals can be implemented as: (non-ANS code, requires well formed
flags of -1 for TRUE and 0 for FALSE):

~~~
'Choices d:create #0 , #0 ,

:choose (flag,true,false)
swap &Choices store-next store
&Choices n:inc + fetch call ;

:if (flag,true) [ ] choose ;
:-if (flag,false) [ ] swap choose ;
~~~

Tests

```
TRUE [ #1 ] [ #2 ] choose
FALSE [ #1 ] [ #2 ] choose
TRUE [ #3 ] if
FALSE [ #4 ] if
TRUE [ #5 ] -if
FALSE [ #6 ] -if
```

I think an ANS implementation of my `choose` would look like:

create Choices 0 , 0 ,

: choose ( flag true false )
Choices CELL+ ! Choices !
CELLS Choices CELL+ + @ EXECUTE ;
Mark Wills
2019-06-05 15:02:09 UTC
Permalink
Post by Charles Childers
Post by Mark Wills
To be Turing complete, you need 0BRANCH too.
I don't have a 0BRANCH (or any other conditional jumps) in my Forth, but
it is Turing complete. (I do have a conditional call, but this is used
as an optimization only; it's perfectly feasible to avoid using it).
My conditionals and loops are built around quotations and the main
conditionals can be implemented as: (non-ANS code, requires well formed
~~~
'Choices d:create #0 , #0 ,
:choose (flag,true,false)
swap &Choices store-next store
&Choices n:inc + fetch call ;
:if (flag,true) [ ] choose ;
:-if (flag,false) [ ] swap choose ;
~~~
Tests
```
TRUE [ #1 ] [ #2 ] choose
FALSE [ #1 ] [ #2 ] choose
TRUE [ #3 ] if
FALSE [ #4 ] if
TRUE [ #5 ] -if
FALSE [ #6 ] -if
```
create Choices 0 , 0 ,
: choose ( flag true false )
Choices CELL+ ! Choices !
Right. So you have conditionals then? Which, we both agree are needed to
be Turing complete, yes? And 0BRANCH is the canonical representation of a
conditional in Forth. Agreed?

You're beng pedantic! Another 'Forther trait'!

Though I think your solution is very cool.
Charles Childers
2019-06-05 15:06:30 UTC
Permalink
Post by Mark Wills
Post by Charles Childers
Post by Mark Wills
To be Turing complete, you need 0BRANCH too.
I don't have a 0BRANCH (or any other conditional jumps) in my Forth, but
it is Turing complete. (I do have a conditional call, but this is used
as an optimization only; it's perfectly feasible to avoid using it).
My conditionals and loops are built around quotations and the main
conditionals can be implemented as: (non-ANS code, requires well formed
~~~
'Choices d:create #0 , #0 ,
:choose (flag,true,false)
swap &Choices store-next store
&Choices n:inc + fetch call ;
:if (flag,true) [ ] choose ;
:-if (flag,false) [ ] swap choose ;
~~~
Tests
```
TRUE [ #1 ] [ #2 ] choose
FALSE [ #1 ] [ #2 ] choose
TRUE [ #3 ] if
FALSE [ #4 ] if
TRUE [ #5 ] -if
FALSE [ #6 ] -if
```
create Choices 0 , 0 ,
: choose ( flag true false )
Choices CELL+ ! Choices !
Right. So you have conditionals then? Which, we both agree are needed to
be Turing complete, yes? And 0BRANCH is the canonical representation of a
conditional in Forth. Agreed?
Agreed.
Post by Mark Wills
You're beng pedantic! Another 'Forther trait'!
Guilty :)
Post by Mark Wills
Though I think your solution is very cool.
Thanks.
NN
2019-06-05 15:27:08 UTC
Permalink
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
What about R> and >R ?
What about CREATE ?
What about . and , and ' ?
What about [ and ] ?
What about : and ; ?
What about HERE and DP and LIT ?
etc.
Rod Pemberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
This issue has been studied over the years quite a lot. 10 seems to be a
very arbitrary number. You cannot buld a working system with only 10
words. Where's BRANCH? To be Turing complete, you need 0BRANCH too.
Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.
They note: "First, from a professional standpoint for those developing
critical controls, having a small system footprint that can be fully
verified and validated is beneficial. The workload in knowing you have
a good basis from which to springboard the application is reasonably
simple as it will not take a long time to perform certification confirmation
efforts. You can only certify from a known surface (surfaces are the interface
between lower level and upper level words)." (ibid.).
Here's the list they came up with (note: there's a couple of non-standardised
A Proposed minimal word set (Knaggs & Bennett, 2015).
1 Memory Access
6.1.0010 ! store
6.1.0150 , comma
6.1.0705 ALIGN
6.1.0706 ALIGNED
6.1.0880 CELL+ cell-plus
6.1.0890 CELLS
6.1.0850 C! c-store
6.1.0860 C, c-comma
CALIGN c-allign
CALIGNED c-alligned
6.1.0897 CHAR+ char-plus
6.1.0898 CHARS chars
2 Arithmetic
6.1.0120 + plus
6.1.0090 * star
6.1.0320 2* two-star
6.1.0110 */MOD star-slash-mod
6.1.0160 - minus
6.1.0230 / slash
6.1.0330 2/ two-slash
6.1.1890 MOD
3 Logic
6.1.0270 0= zero-equals
6.1.0480 < less-than
6.1.0720 AND
6.1.1720 INVERT
6.2.2298 TRUE
6.1.1805 LSHIFT l-shift
6.1.0530 = equals
6.1.0540 > greater-than
6.1.1980 OR
6.1.2490 XOR x-or
6.2.1485 FALSE
6.1.2162 RSHIFT r-shift
4 Stack
6.1.1290 DUP dupe
6.1.2260 SWAP
6.1.0580 >R to-r
6.1.1260 DROP
6.1.1990 OVER
6.1.2060 R> r-from
6.1.2160 ROT rote
5 Flow Control
6.1.1700 IF
6.1.2270 THEN
6.1.2430 WHILE
6.1.2140 REPEAT
6.1.1240 DO
6.1.1680 I
6.1.0070 ' tick
6.1.1310 ELSE
6.1.0760 BEGIN
6.2.0700 AGAIN
6.1.2390 UNTIL
6.1.1800 LOOP
6.1.1730 J
6.1.1370 EXECUTE
6 Defnitions
6.1.0450 : colon
6.1.0950 CONSTANT
6.1.1000 CREATE
6.1.0460 ; semicolon
6.1.2410 VARIABLE
6.1.1250 DOES> does
7 Device
6.1.1750 KEY
6.1.1320 EMIT
10.6.1.1755 KEY? key-question
6.1.0990 CR c-r
8 Tools
6.1.0080 ( paren
15.6.1.0220 .S dot-s
-------------
Knaggs, P., Bennett, P. 2015. 'Minimal Forth'. EuroForth conference proceedings,
24th Septemeber, 2015.
https://groups.google.com/forum/#!msg/comp.lang.forth/ESZD4h1prcw/jFXN7dvtCFMJ


Always boggles my mind when I see this.

NN
A. K.
2019-06-05 19:09:55 UTC
Permalink
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
What about R> and >R ?
What about CREATE ?
What about . and , and ' ?
What about [ and ] ?
What about : and ; ?
What about HERE and DP and LIT ?
etc.
Rod Pemberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
This issue has been studied over the years quite a lot. 10 seems to be a
very arbitrary number. You cannot buld a working system with only 10
words. Where's BRANCH? To be Turing complete, you need 0BRANCH too.
Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.
They note: "First, from a professional standpoint for those developing
critical controls, having a small system footprint that can be fully
verified and validated is beneficial. The workload in knowing you have
a good basis from which to springboard the application is reasonably
simple as it will not take a long time to perform certification confirmation
efforts. You can only certify from a known surface (surfaces are the interface
between lower level and upper level words)." (ibid.).
Here's the list they came up with (note: there's a couple of non-standardised
A Proposed minimal word set (Knaggs & Bennett, 2015).
1 Memory Access
6.1.0010 ! store
6.1.0150 , comma
6.1.0705 ALIGN
6.1.0706 ALIGNED
6.1.0880 CELL+ cell-plus
6.1.0890 CELLS
6.1.0850 C! c-store
6.1.0860 C, c-comma
CALIGN c-allign
CALIGNED c-alligned
6.1.0897 CHAR+ char-plus
6.1.0898 CHARS chars
2 Arithmetic
6.1.0120 + plus
6.1.0090 * star
6.1.0320 2* two-star
6.1.0110 */MOD star-slash-mod
6.1.0160 - minus
6.1.0230 / slash
6.1.0330 2/ two-slash
6.1.1890 MOD
3 Logic
6.1.0270 0= zero-equals
6.1.0480 < less-than
6.1.0720 AND
6.1.1720 INVERT
6.2.2298 TRUE
6.1.1805 LSHIFT l-shift
6.1.0530 = equals
6.1.0540 > greater-than
6.1.1980 OR
6.1.2490 XOR x-or
6.2.1485 FALSE
6.1.2162 RSHIFT r-shift
4 Stack
6.1.1290 DUP dupe
6.1.2260 SWAP
6.1.0580 >R to-r
6.1.1260 DROP
6.1.1990 OVER
6.1.2060 R> r-from
6.1.2160 ROT rote
5 Flow Control
6.1.1700 IF
6.1.2270 THEN
6.1.2430 WHILE
6.1.2140 REPEAT
6.1.1240 DO
6.1.1680 I
6.1.0070 ' tick
6.1.1310 ELSE
6.1.0760 BEGIN
6.2.0700 AGAIN
6.1.2390 UNTIL
6.1.1800 LOOP
6.1.1730 J
6.1.1370 EXECUTE
6 Defnitions
6.1.0450 : colon
6.1.0950 CONSTANT
6.1.1000 CREATE
6.1.0460 ; semicolon
6.1.2410 VARIABLE
6.1.1250 DOES> does
7 Device
6.1.1750 KEY
6.1.1320 EMIT
10.6.1.1755 KEY? key-question
6.1.0990 CR c-r
8 Tools
6.1.0080 ( paren
15.6.1.0220 .S dot-s
-------------
Knaggs, P., Bennett, P. 2015. 'Minimal Forth'. EuroForth conference proceedings,
24th Septemeber, 2015.
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)

I always wondered why nobody cared to implement a standard-conformant
Forth system reference implementation based on a minimal primitive wordset.

But then I know, DIY et cetera...
dxforth
2019-06-06 03:31:23 UTC
Permalink
Post by A. K.
...
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)
eForth was created by Bill Muench. His forth compiler that he
used to create it was B.EXE whose word count exceeded 600 words.
A. K.
2019-06-06 05:48:40 UTC
Permalink
Post by dxforth
Post by A. K.
...
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)
eForth was created by Bill Muench. His forth compiler that he
used to create it was B.EXE whose word count exceeded 600 words.
I was referring f.ex. to a file called EFORTH.X86
not to his toolset.
dxforth
2019-06-06 06:25:39 UTC
Permalink
Post by A. K.
Post by dxforth
Post by A. K.
...
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)
eForth was created by Bill Muench. His forth compiler that he
used to create it was B.EXE whose word count exceeded 600 words.
I was referring f.ex. to a file called EFORTH.X86
not to his toolset.
Yes but given the option of something more convenient to use, who
chooses eForth? For all the talk of minimalist wordsets, I see
few forthers prepared to live in a cave with Fig-Forth and a hair
shirt.
A. K.
2019-06-06 10:27:31 UTC
Permalink
Post by dxforth
Post by A. K.
Post by dxforth
Post by A. K.
...
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)
eForth was created by Bill Muench. His forth compiler that he
used to create it was B.EXE whose word count exceeded 600 words.
I was referring f.ex. to a file called EFORTH.X86
not to his toolset.
Yes but given the option of something more convenient to use, who
chooses eForth? For all the talk of minimalist wordsets, I see
few forthers prepared to live in a cave with Fig-Forth and a hair
shirt.
I like that picture. :-)

So you would put Scheme into the same cave?
dxforth
2019-06-07 01:17:11 UTC
Permalink
Post by A. K.
Post by dxforth
Post by A. K.
Post by dxforth
Post by A. K.
...
Those words could still be minimized somewhat, but...
(and eforth has been around since much earlier)
eForth was created by Bill Muench. His forth compiler that he
used to create it was B.EXE whose word count exceeded 600 words.
I was referring f.ex. to a file called EFORTH.X86
not to his toolset.
Yes but given the option of something more convenient to use, who
chooses eForth? For all the talk of minimalist wordsets, I see
few forthers prepared to live in a cave with Fig-Forth and a hair
shirt.
I like that picture. :-)
So you would put Scheme into the same cave?
No. Scheme is "civilized" and accepting of social norms as are most
forthers. OTOH Real Forth (what Chuck does) is closer to the school
of Cynicism in which it's possible to 'live in a bathtub and own
almost nothing'.
a***@littlepinkcloud.invalid
2019-06-06 08:08:30 UTC
Permalink
Those words could still be minimized somewhat, but... (and eforth
has been around since much earlier)
I always wondered why nobody cared to implement a standard-
conformant Forth system reference implementation based on a minimal
primitive wordset.
What would you do with the result? Sure, I've created a pruned minimal
Forth when I only had a 4k ROM, but standard-conformant? Why?

Andrew.
Anton Ertl
2019-06-06 08:25:10 UTC
Permalink
Post by a***@littlepinkcloud.invalid
Post by A. K.
I always wondered why nobody cared to implement a standard-
conformant Forth system reference implementation based on a minimal
primitive wordset.
What would you do with the result? Sure, I've created a pruned minimal
Forth when I only had a 4k ROM, but standard-conformant? Why?
The usual reason: You want to port to a new architecture, and want to
write as few primitives as possible at the start. Once these are
debugged, you can write and debug further primitives one by one to
improve performance. Gforth EC works that way: There is Forth
replacement code for a lot of primitives, and if the primitive is not
defined, the replacement code is used. If you implement only the
minimal set of primitives, Gforth EC is very slow. You have primitive
replacements like:

: branch ( #a_target -- )
r> @ >r ;

Note that this relies on return address manipulation.

Some replacements are really expensive:

: 2/ ( n1 -- n2 )
dup MINI and IF 1 ELSE 0 THEN
[ bits/char cell * 1- ] literal
0 DO 2* swap dup 2* >r MINI and
IF 1 ELSE 0 THEN or r> swap
LOOP nip ;

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2018: http://www.euroforth.org/ef18/
a***@littlepinkcloud.invalid
2019-06-06 08:48:16 UTC
Permalink
Post by Anton Ertl
Post by a***@littlepinkcloud.invalid
Post by A. K.
I always wondered why nobody cared to implement a standard-
conformant Forth system reference implementation based on a minimal
primitive wordset.
What would you do with the result? Sure, I've created a pruned minimal
Forth when I only had a 4k ROM, but standard-conformant? Why?
The usual reason: You want to port to a new architecture, and want
to write as few primitives as possible at the start. Once these are
debugged, you can write and debug further primitives one by one to
improve performance.
What for? Surely you'd write the primitives one at a time. Of what use
would the half-written Forth with the slow replacements be?

Andrew.
Anton Ertl
2019-06-06 09:39:31 UTC
Permalink
Post by a***@littlepinkcloud.invalid
Post by Anton Ertl
The usual reason: You want to port to a new architecture, and want
to write as few primitives as possible at the start. Once these are
debugged, you can write and debug further primitives one by one to
improve performance.
What for? Surely you'd write the primitives one at a time. Of what use
would the half-written Forth with the slow replacements be?
There is no half-written Forth involved in this scenario.

I am sorry if my description of the benefit above is unclear: You
start with a smaller critical mass of primitives, which usually
contains fewer bugs, and the bugs are easier to find (because there is
less code in which they can hide). Writing and debugging further
primitives one by one again makes it easy to find the bugs.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2018: http://www.euroforth.org/ef18/
Mark Wills
2019-06-06 10:02:13 UTC
Permalink
Post by Anton Ertl
Post by a***@littlepinkcloud.invalid
Post by Anton Ertl
The usual reason: You want to port to a new architecture, and want
to write as few primitives as possible at the start. Once these are
debugged, you can write and debug further primitives one by one to
improve performance.
What for? Surely you'd write the primitives one at a time. Of what use
would the half-written Forth with the slow replacements be?
There is no half-written Forth involved in this scenario.
I am sorry if my description of the benefit above is unclear: You
start with a smaller critical mass of primitives, which usually
contains fewer bugs, and the bugs are easier to find (because there is
less code in which they can hide). Writing and debugging further
primitives one by one again makes it easy to find the bugs.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2018: http://www.euroforth.org/ef18/
That's how I wrote TurboForth. Started with a small 'nucleus' and grew
it out towards the edges. Things like file IO were some of the last things
to go in.
none) (albert
2019-06-06 11:13:03 UTC
Permalink
Post by Anton Ertl
Post by a***@littlepinkcloud.invalid
Post by Anton Ertl
The usual reason: You want to port to a new architecture, and want
to write as few primitives as possible at the start. Once these are
debugged, you can write and debug further primitives one by one to
improve performance.
What for? Surely you'd write the primitives one at a time. Of what use
would the half-written Forth with the slow replacements be?
There is no half-written Forth involved in this scenario.
Exactly. My 64 bit arm forth is slow and could benefit from replacing
a lot of primitives. But it is not half-written by any standard. It
has the full documentation and the full regressiontest. If a primitive
fails after replacement, that is immediately exposed by the regression
test.
Post by Anton Ertl
I am sorry if my description of the benefit above is unclear: You
start with a smaller critical mass of primitives, which usually
contains fewer bugs, and the bugs are easier to find (because there is
less code in which they can hide). Writing and debugging further
primitives one by one again makes it easy to find the bugs.
It is even so easy that this debugging stage is usually short.
Forth is its own debugger. Having a .S (maybe initially printing
all numbers in hex) helps enormously.
Post by Anton Ertl
- anton
Groetjes Albert
--
This is the first day of the end of your life.
It may not kill you, but it does make your weaker.
If you can't beat them, too bad.
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Anton Ertl
2019-06-06 09:48:35 UTC
Permalink
Post by Anton Ertl
You want to port to a new architecture, and want to
write as few primitives as possible at the start.
The primitives and run-time routines without replacement code are:

docol
dovar
dodoes
docon
dodefer
;s
execute
@
!
sp@
sp!
rp@
rp!
+
xor
and
key
emit
(key?)
emit?
(bye)

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2018: http://www.euroforth.org/ef18/
Gerry Jackson
2019-06-06 08:43:51 UTC
Permalink
Post by a***@littlepinkcloud.invalid
Those words could still be minimized somewhat, but... (and eforth
has been around since much earlier)
I always wondered why nobody cared to implement a standard-
conformant Forth system reference implementation based on a minimal
primitive wordset.
What would you do with the result? Sure, I've created a pruned minimal
Forth when I only had a 4k ROM, but standard-conformant? Why?
Something like that would have been useful as a reference implementation
when the ANS Forth standard was developed. It would have exposed the
standard to the scrutiny/use of a wider audience
--
Gerry
dxforth
2019-06-06 02:55:04 UTC
Permalink
Post by Mark Wills
...
Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.
How are you going extend it without file or other words? A minimum set of
ANS-Forth words has always been antithetical to what ANS was about - which
was making Forth acceptable to the masses. Nobody - including myself -
would find 69 words acceptable.
Rick C
2019-06-06 03:49:15 UTC
Permalink
Post by dxforth
Post by Mark Wills
...
Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.
How are you going extend it without file or other words? A minimum set of
ANS-Forth words has always been antithetical to what ANS was about - which
was making Forth acceptable to the masses. Nobody - including myself -
would find 69 words acceptable.
I'm not so interested in what words would be needed in a Forth compiler. I'm more interested in the primitives that would be optimal for a stack processor to implement a Forth virtual machine. Many people seem to think Forth words should be implemented directly in hardware, but I think that is less efficient than picking an optimal set of primitives that would be good for a Forth target ISA.

Hopefully it would be significantly smaller than 69 words. My personal preference would be to keep all instructions to what can be executed on simple hardware in a single clock cycle. That simplifies a lot of things in the hardware.
--
Rick C.

+ Get a 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209
Rod Pemberton
2019-06-10 08:45:02 UTC
Permalink
On Wed, 5 Jun 2019 20:49:15 -0700 (PDT)
Post by Rick C
I'm more interested in the primitives that would be
optimal for a stack processor to implement a Forth virtual machine.
Your answer to that is rigth here Rick:
(not that you'll ever see my reply ...)

"Stack Computers" by Philip J. Koopman Jr.
https://users.ece.cmu.edu/~koopman/stack_computers/index.html


Rod Pemberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
none) (albert
2019-06-06 11:29:24 UTC
Permalink
Post by dxforth
Post by Mark Wills
...
Knaggs & Bennett (2015) produced a list of 69 words which they believed
should be in every Forth system, desktop or embedded. I think they did a
great job of distilling the required words down into an essential list,
with enough words available to build new features/words on.
How are you going extend it without file or other words? A minimum set of
ANS-Forth words has always been antithetical to what ANS was about - which
was making Forth acceptable to the masses. Nobody - including myself -
would find 69 words acceptable.
Using standard input and output to have an interpreter is essential
anyway. That is small compared to file io and can be used to bring
file io up. For ciforth the library in blocks is essential, but that
requires OPEN-FILE REPOSITION-FILE and READ-FILE. Of those only
READ-FILE is needed in an early debugging stage (from standard input).
Those other words need porting to a different OS (like from
32 to 64 bit arm linux) but can be developped one by one.

Not too surprisingly, the READ-FILE is portable accross 32 and 64 bit,
(once a generic system call is introduced and the _NR__ number for
read is filled in properly.)

Groetjes Albert
--
This is the first day of the end of your life.
It may not kill you, but it does make your weaker.
If you can't beat them, too bad.
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Rod Pemberton
2019-06-10 08:44:49 UTC
Permalink
On Wed, 5 Jun 2019 06:15:26 -0700 (PDT)
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
This issue has been studied over the years quite a lot.
Well, that's what I thought upon first read of the thread. That this
was about primitives (or low-level words as Ms Rather prefers to call
them). Except, that it's not about primitives. It's about what
Helmar calls "Holy words" in Forth.

Helmar said this elsewhere in the thread:

HW> This is also not about the absolut minimum. [...]
HW> That 10 words are useful for something.
HW> They are not "that needed minimal set".

In other words, he's not talking about primitives, but about some other
arbitrary criteria over what words are truly useful or usable in
Forth. Those words he calls "Holy words".

IIRC, Anton ranked frequency of usage words, and Philip Koopman did
as well for his book on stack processors.


Rod PEmberton
--
Once upon a time, many decades ago in a place far away, humble people
sought their freedom, and lost. "Ideas are bulletproof."
A. K.
2019-06-10 09:50:55 UTC
Permalink
Post by Rod Pemberton
On Wed, 5 Jun 2019 06:15:26 -0700 (PDT)
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
This issue has been studied over the years quite a lot.
Well, that's what I thought upon first read of the thread. That this
was about primitives (or low-level words as Ms Rather prefers to call
them). Except, that it's not about primitives. It's about what
Helmar calls "Holy words" in Forth.
HW> This is also not about the absolut minimum. [...]
HW> That 10 words are useful for something.
HW> They are not "that needed minimal set".
In other words, he's not talking about primitives, but about some other
arbitrary criteria over what words are truly useful or usable in
Forth. Those words he calls "Holy words".
IIRC, Anton ranked frequency of usage words, and Philip Koopman did
as well for his book on stack processors.
Forth words can be put into 3 categories:
1. control words of the Forth machine, like stack operators
2. control words of the Forth compiler, like ['] etc
3. pure application words, like math operators

Now which words are "holy" within which category?

There is no reasonable answer without prior definition of their application target.

F.ex. Forth compiler makers have different priority than f.ex. numeric math programmers.
Rick C
2019-06-10 11:37:22 UTC
Permalink
Post by A. K.
Post by Rod Pemberton
On Wed, 5 Jun 2019 06:15:26 -0700 (PDT)
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
This issue has been studied over the years quite a lot.
Well, that's what I thought upon first read of the thread. That this
was about primitives (or low-level words as Ms Rather prefers to call
them). Except, that it's not about primitives. It's about what
Helmar calls "Holy words" in Forth.
HW> This is also not about the absolut minimum. [...]
HW> That 10 words are useful for something.
HW> They are not "that needed minimal set".
In other words, he's not talking about primitives, but about some other
arbitrary criteria over what words are truly useful or usable in
Forth. Those words he calls "Holy words".
IIRC, Anton ranked frequency of usage words, and Philip Koopman did
as well for his book on stack processors.
1. control words of the Forth machine, like stack operators
2. control words of the Forth compiler, like ['] etc
3. pure application words, like math operators
Now which words are "holy" within which category?
There is no reasonable answer without prior definition of their application target.
F.ex. Forth compiler makers have different priority than f.ex. numeric math programmers.
I'm not sure your categories are complete. I think there are a number of lower level words that are typically used in most implementations that aren't really any of those categories without being inappropriately shoehorned into one. Try listing all the works of a Forth and see if they all fit into your three categories.

For an example, when implemented under an OS there is usually a word to call the OS to perform various operations. I don't see that as falling into any of these groups.
--
Rick C.

-- Get a 1,000 miles of free Supercharging
-- Tesla referral code - https://ts.la/richard11209
A. K.
2019-06-10 15:58:30 UTC
Permalink
Post by Rick C
Post by A. K.
Post by Rod Pemberton
On Wed, 5 Jun 2019 06:15:26 -0700 (PDT)
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
This issue has been studied over the years quite a lot.
Well, that's what I thought upon first read of the thread. That this
was about primitives (or low-level words as Ms Rather prefers to call
them). Except, that it's not about primitives. It's about what
Helmar calls "Holy words" in Forth.
HW> This is also not about the absolut minimum. [...]
HW> That 10 words are useful for something.
HW> They are not "that needed minimal set".
In other words, he's not talking about primitives, but about some other
arbitrary criteria over what words are truly useful or usable in
Forth. Those words he calls "Holy words".
IIRC, Anton ranked frequency of usage words, and Philip Koopman did
as well for his book on stack processors.
1. control words of the Forth machine, like stack operators
2. control words of the Forth compiler, like ['] etc
3. pure application words, like math operators
Now which words are "holy" within which category?
There is no reasonable answer without prior definition of their application target.
F.ex. Forth compiler makers have different priority than f.ex. numeric math programmers.
I'm not sure your categories are complete. I think there are a number of lower level words that are typically used in most implementations that aren't really any of those categories without being inappropriately shoehorned into one. Try listing all the works of a Forth and see if they all fit into your three categories.
For an example, when implemented under an OS there is usually a word to call the OS to perform various operations. I don't see that as falling into any of these groups.
AFAIK the CORE wordset is not OS-specific.

Of course you need some terminal IO but I would subsume that under machine control.
Rick C
2019-06-10 17:49:23 UTC
Permalink
Post by A. K.
Post by Rick C
Post by A. K.
Post by Rod Pemberton
On Wed, 5 Jun 2019 06:15:26 -0700 (PDT)
Post by Mark Wills
Post by Rod Pemberton
On Mon, 8 Apr 2019 10:20:41 -0700 (PDT)
Post by Helmar Wodtke
DUP
DROP
SWAP
OVER
+
*
-
;
VALUE
And the last one, ... (we do not want to discuss)
Why are the words you chose "Holy"? What criterion?
This issue has been studied over the years quite a lot.
Well, that's what I thought upon first read of the thread. That this
was about primitives (or low-level words as Ms Rather prefers to call
them). Except, that it's not about primitives. It's about what
Helmar calls "Holy words" in Forth.
HW> This is also not about the absolut minimum. [...]
HW> That 10 words are useful for something.
HW> They are not "that needed minimal set".
In other words, he's not talking about primitives, but about some other
arbitrary criteria over what words are truly useful or usable in
Forth. Those words he calls "Holy words".
IIRC, Anton ranked frequency of usage words, and Philip Koopman did
as well for his book on stack processors.
1. control words of the Forth machine, like stack operators
2. control words of the Forth compiler, like ['] etc
3. pure application words, like math operators
Now which words are "holy" within which category?
There is no reasonable answer without prior definition of their application target.
F.ex. Forth compiler makers have different priority than f.ex. numeric math programmers.
I'm not sure your categories are complete. I think there are a number of lower level words that are typically used in most implementations that aren't really any of those categories without being inappropriately shoehorned into one. Try listing all the works of a Forth and see if they all fit into your three categories.
For an example, when implemented under an OS there is usually a word to call the OS to perform various operations. I don't see that as falling into any of these groups.
AFAIK the CORE wordset is not OS-specific.
Of course you need some terminal IO but I would subsume that under machine control.
I would list terminal I/O separately in an I/O category (likely with file I/O) because it is not really needed for the Forth virtual machine. It is needed if your application requires that type of I/O. It would be needed for the Forth compiler, but the Forth compiler may not be needed when running an app on a target.

Not sure what your point is about the Forth word set not being OS specific. Nothing about Forth is OS specific that I know of. Forth doesn't even require to be hosted under an OS. I think I'm missing your point.
--
Rick C.

-+ Get a 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209
none) (albert
2019-06-11 10:06:07 UTC
Permalink
Post by Rick C
Post by A. K.
AFAIK the CORE wordset is not OS-specific.
Of course you need some terminal IO but I would subsume that under machine control.
I would list terminal I/O separately in an I/O category (likely with file I/O) because it is not really needed for the Forth virtual machine.
It is needed if your application requires that type of I/O. It would be needed for the Forth compiler, but the Forth compiler may not be needed
when running an app on a target.
Try reading a newspaper where the lines run 146 char's.
No, you don't need I/O for the compiler proper in Forth,
because the compiler proper is EVALUATE.
It is a factor of QUIT, but QUIT is a user interface.
Post by Rick C
Not sure what your point is about the Forth word set not being OS specific. Nothing about Forth is OS specific that I know of. Forth doesn't
even require to be hosted under an OS. I think I'm missing your point.
--
Rick C.
Groetjes Albert
--
This is the first day of the end of your life.
It may not kill you, but it does make your weaker.
If you can't beat them, too bad.
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Loading...