Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is a Forth without "IF...THEN" a Forth?

336 views
Skip to first unread message

Ron Aaron

unread,
Jan 7, 2018, 3:40:33 AM1/7/18
to
On the Facebook Forth group, it was opined that Forths do have a syntax
(despite the oft asserted "Forth has no syntax"), and that the syntax
includes IF...ELSE...THEN. "Firstly there's the fundamental syntax of
words separated by white space. Beyond that there's the : ... ;
definition syntax, the IF ... ELSE .. THEN and various LOOP syntaxes. "

I responded that "It's more correct to say that, apart from
whitespace-delimited words, there's no required syntax. A Forth doesn't
have to implement the ANS wordset, so "IF...ELSE...THEN" might not
necessarily be part of a specific Forth implementation."

And I think I'm correct, since there are in fact
"minimal-instruction-set" Forths which are nevertheless considered Forths.

What do you think?

JUERGEN

unread,
Jan 7, 2018, 6:27:25 AM1/7/18
to
See Bernd's minimum set.
I always wanted to understand how you get from there
https://wiki.forth-ev.de/doku.php/en:words:kernel_embedded:minimum_word_set
to the 35 Words for example, ( or the 33 Basic eForth Word Set )
https://wiki.forth-ev.de/doku.php/en:projects:a-start-with-forth:start
just using Forth Words, and basically implement and tick off one Word after the other of the standard
https://forth-standard.org/
following any preferred sequence.
Until you end up for example covering the eForth Word Set or similar all in Forth. Speed does not matter here - just to see how it all hangs together - and working.

Mark Wills

unread,
Jan 7, 2018, 6:32:56 AM1/7/18
to
IF ELSE THEN are defined in the standard as far as I know, and most systems,
including my own, will complain if you attempt to compile an IF without a
matching THEN, so it could be reasonably argued (IMO) that *in the case of
IF...ELSE...THEN* there is a syntax. However, (at least in my mind), I see
IF...ELSE...THEN and friends (BEGIN...UNTIL et al) as nothing more than
macros. They are convenience features. They actually compile lower level
code such as 0BRANCH and save us from the toil of having to manually
calculate branch offsets and forward/backward branches. They are an abstraction.

If we look at the code that these macros actually compile, it is indeed
syntax-less code. You're free to compile a 0BRANCH instruction yourself if
you want to, with a nonsense branch offset, or no offset at all, just as you
are in assembly language.

So, in its purest sense, Forth is indeed syntax-less, but there are some
convenience features, macros, that do have some syntax requirements.

Forth itself has no syntax in the same way as machine code has no syntax.

NN

unread,
Jan 7, 2018, 7:56:46 AM1/7/18
to
On Sunday, 7 January 2018 08:40:33 UTC, Ron Aaron wrote:
Ignoring white space are there any forths that dont use :

: newword word1 word2 ... wordn ;

to define a new word ?

or

value constant name

to define constants

Surely this is syntax ?

minf...@arcor.de

unread,
Jan 7, 2018, 9:10:09 AM1/7/18
to
Consider a CPU or VM whose operations always generate a success flag that
is checked by the succeeding operation. On success flag not set by the preceding
operation: skip the actual operation and set the success flag.

On such a machine 0BRANCH is not required.

(afaik some ARM operators work in this way)

Ilya Tarasov

unread,
Jan 7, 2018, 11:37:36 AM1/7/18
to
воскресенье, 7 января 2018 г., 11:40:33 UTC+3 пользователь Ron Aaron написал:
Maybe it is better to say 'there are no special rules for words like IF in Forth, we must use whitespace delimiter to define IF THEN and other control structures like for all words'.

Anton Ertl

unread,
Jan 7, 2018, 12:58:08 PM1/7/18
to
Ron Aaron <ramb...@gmail.com> writes:
>On the Facebook Forth group, it was opined that Forths do have a syntax
>(despite the oft asserted "Forth has no syntax"), and that the syntax
>includes IF...ELSE...THEN. "Firstly there's the fundamental syntax of
>words separated by white space. Beyond that there's the : ... ;
>definition syntax, the IF ... ELSE .. THEN and various LOOP syntaxes. "
>
>I responded that "It's more correct to say that, apart from
>whitespace-delimited words, there's no required syntax. A Forth doesn't
>have to implement the ANS wordset, so "IF...ELSE...THEN" might not
>necessarily be part of a specific Forth implementation."

I think that misses the point. If you have a Forth system that has IF
... ELSE ... THEN (and most do), and excluding other cop-outs such as
redefinitions of these words, you must follow IF with a THEN, and may
put ELSE in between (but not outside). Otherwise you will not get a
working Forth program, not even in SwiftForth, which is very lax about
error reporting:

: foo if ; \ Unbalanced control structure
: bar ahead again ; \ ok
bar \ Invalid memory address

More generally, Jaanus Poial [poeial94] has pointed out that the stack
effects can be seen as a kind of syntax, and that this is a more
powerful formalism than context-free grammars. In the case of
IF...ELSE...THEN, this works through the compile-time control-flow
stack, and so this becomes visible in most systems at compile time.

@InProceedings{poeial94,
author = "Jaanus P{\"o}ial",
title = "Forth and Formal Language Theory",
crossref = "euroforth94",
pages = "47--52",
annote = "Shows that the stack effect notation is at least as
powerful as context-free grammars and that it is better
suited for specifying the syntax of Forth."
}

@Proceedings{euroforth94,
title = "EuroForth~'94 Conference Proceedings",
booktitle = "EuroForth~'94 Conference Proceedings",
year = "1994",
key = "EuroForth '94",
address = "Winchester, UK",
}

- 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 2017: http://euro.theforth.net/

Rod Pemberton

unread,
Jan 7, 2018, 6:12:21 PM1/7/18
to
On Sun, 7 Jan 2018 10:40:28 +0200
Ron Aaron <ramb...@gmail.com> wrote:

> On the Facebook Forth group, it was opined that Forths do have a
> syntax (despite the oft asserted "Forth has no syntax"),

Didn't I bring this up some time ago? I'm pretty sure I was
pooh-poohed by the group when I did.

E.g., various commonly used, repeated characters, creates a
very visual pseudo-syntax when looking at high-level Forth code:

:; around definitions
[] around immediate code in definitions
[] around the names of compiling or postponing words
() around the names of low-level words
? at the beginning of conditional or checking words
" at the beginning and end of strings
@ and ! as part of words for fetch and store
< and > as part of words for to and from

I.e., I see these defacto notations as a rudimentary informal syntax.

> and that the syntax includes IF...ELSE...THEN.

I take it you mean Forth's control-flow is a block-oriented syntax,
like COBOL.

> "Firstly there's the fundamental
> syntax of words separated by white space. Beyond that there's
> the : ... ; definition syntax, the IF ... ELSE .. THEN and various
> LOOP syntaxes. "

...

> I responded that "It's more correct to say that, apart from
> whitespace-delimited words, there's no required syntax.

True. This is correct.

> A Forth
> doesn't have to implement the ANS wordset, so "IF...ELSE...THEN"
> might not necessarily be part of a specific Forth implementation."

Ok.

> And I think I'm correct, since there are in fact
> "minimal-instruction-set" Forths which are nevertheless considered
> Forths.
>
> What do you think?

You're correct, but see above. What do you think?


Rod Pemberton
--
Mark Zuckerberg says he's going to "fix" Facebook in 2018. Neuter is
the word.

Elizabeth D. Rather

unread,
Jan 7, 2018, 7:18:27 PM1/7/18
to
"The syntax of a computer language is the set of rules that defines the
combinations of symbols that are considered to be a correctly structured
document or fragment in that language." (Wikipedia)

To that extent, : [name] [words] ; is syntax, as are structures such as
IF ... [ ELSE ] ... THEN and others. But beyond that, the simple rule
that governs constants is the same as for all other Forth words: they
*may* expect arguments on the data stack and *may* leave results there;
they *may* also parse the input stream. Thus in the case of constants,
the defining word expects an value on the stack, but whether it's a
literal number or the result of a sequence of words that produce the
value is irrelevant. I'm not sure that really qualifies as syntax.

Cheers,
Elizabeth

--
Elizabeth D. Rather
FORTH, Inc.
6080 Center Drive, Suite 600
Los Angeles, CA 90045
USA

Rod Pemberton

unread,
Jan 7, 2018, 8:06:12 PM1/7/18
to
On Sun, 7 Jan 2018 03:27:23 -0800 (PST)
JUERGEN <epld...@aol.com> wrote:

> I always wanted to understand how you get from there
> https://wiki.forth-ev.de/doku.php/en:words:kernel_embedded:minimum_word_set
> to the 35 Words for example, ( or the 33 Basic eForth Word Set )
> https://wiki.forth-ev.de/doku.php/en:projects:a-start-with-forth:start
> just using Forth Words, and basically implement and tick off one Word
> after the other of the standard https://forth-standard.org/
> following any preferred sequence.
> Until you end up for example covering the eForth Word Set or similar
> all in Forth. Speed does not matter here - just to see how it all
> hangs together - and working.

I'm starting a new thread for my reply to this.

Ron Aaron

unread,
Jan 8, 2018, 2:07:45 AM1/8/18
to


On 01/08/18 01:13, Rod Pemberton wrote:
...
> E.g., various commonly used, repeated characters, creates a
> very visual pseudo-syntax when looking at high-level Forth code:
>
> :; around definitions
> [] around immediate code in definitions
> [] around the names of compiling or postponing words
> () around the names of low-level words
> ? at the beginning of conditional or checking words
> " at the beginning and end of strings
> @ and ! as part of words for fetch and store
> < and > as part of words for to and from
>
> I.e., I see these defacto notations as a rudimentary informal syntax.

I would say that they are commonly used, but don't qualify as a syntax.
Since a Forth could have none of those words and yet still be a Forth
(albeit a strange looking one).

To quote from Charles Moore's original paper on Forth:

"We have been speaking of FORTH as a program that implements a language
and we have described the dictionary that explains the language to the
computer. But we have not described the language beyond mentioning the
basic kinds of words: nouns, verbs, and definitions.

There are two reasons for this. FORTH, to an honesty significant extent,
only supplies the tools whereby a user can construct a language that
looks as he wants it to. Second, there are 200 words in the dictionary,
all of which are intended to be used - and therefore must be explained."

So the creator of Forth himself seems to agree with my premise, e.g.
that Forth describes a language framework more than a specific syntax.
And various implementations of Forth which don't conform to the expected
do exist (and presumably are used).


>
>> and that the syntax includes IF...ELSE...THEN.
>
> I take it you mean Forth's control-flow is a block-oriented syntax,
> like COBOL.

No, just that one need not /implement/ them at all, and it would still
be a Forth.

I'm not arguing at all that one /should/ implement such a Forth, just to
be clear.

Ron Aaron

unread,
Jan 8, 2018, 2:11:32 AM1/8/18
to


On 01/07/18 19:34, Anton Ertl wrote:
> Ron Aaron <ramb...@gmail.com> writes:

>> I responded that "It's more correct to say that, apart from
>> whitespace-delimited words, there's no required syntax. A Forth doesn't
>> have to implement the ANS wordset, so "IF...ELSE...THEN" might not
>> necessarily be part of a specific Forth implementation."

> I think that misses the point. If you have a Forth system that has IF
> ... ELSE ... THEN (and most do), and excluding other cop-outs such as
> redefinitions of these words, you must follow IF with a THEN, and may
> put ELSE in between (but not outside). Otherwise you will not get a
> working Forth program, not even in SwiftForth, which is very lax about
> error reporting:

But surely that is an implementation detail? *If* you implement
IF...ELSE...THEN, then it would only make sense to make them operate in
the manner you describe. Certainly, I have difficulty imagining a
scenario in which it would be useful to make them do something else.

My point is, rather simply, that implementing a "Forth" does not require
one to implement any particular words, nor any particular syntax
excepting the whitespace-delimited parser (and a dictionary, but that's
internal).


>
> : foo if ; \ Unbalanced control structure
> : bar ahead again ; \ ok
> bar \ Invalid memory address
>
> More generally, Jaanus Poial [poeial94] has pointed out that the stack
> effects can be seen as a kind of syntax, and that this is a more
> powerful formalism than context-free grammars. In the case of
> IF...ELSE...THEN, this works through the compile-time control-flow
> stack, and so this becomes visible in most systems at compile time.

OK, I'll have to check that out.

Ron Aaron

unread,
Jan 8, 2018, 2:12:08 AM1/8/18
to


On 01/07/18 18:37, Ilya Tarasov wrote:

> Maybe it is better to say 'there are no special rules for words like IF in Forth, we must use whitespace delimiter to define IF THEN and other control structures like for all words'.

Yes, that encapsulates my meaning, I think.

Ron Aaron

unread,
Jan 8, 2018, 2:13:39 AM1/8/18
to


On 01/07/18 14:56, NN wrote:

> Ignoring white space are there any forths that dont use :
>
> : newword word1 word2 ... wordn ;
>
> to define a new word ?
>
> or
>
> value constant name
>
> to define constants
>
> Surely this is syntax ?

8th doesn't use "constant", so the answer is "yes". And I'm aware of
other Forths which don't have "constant" although I can't offhand think
of any which don't use : ... ;

Ron Aaron

unread,
Jan 8, 2018, 2:14:51 AM1/8/18
to


On 01/07/18 13:32, Mark Wills wrote:

> So, in its purest sense, Forth is indeed syntax-less, but there are some
> convenience features, macros, that do have some syntax requirements.
>
> Forth itself has no syntax in the same way as machine code has no syntax.
>

Well, yes: any specific *implementation* of Forth will have its own
syntax. But Forth /per se/ doesn't obligate a syntax.

Gerry Jackson

unread,
Jan 8, 2018, 2:44:24 AM1/8/18
to
On 07/01/2018 11:32, Mark Wills wrote:
> So, in its purest sense, Forth is indeed syntax-less, but there are some
> convenience features, macros, that do have some syntax requirements.
>
> Forth itself has no syntax in the same way as machine code has no syntax.

I think that is incorrect. From
https://en.wikipedia.org/wiki/Syntax_(programming_languages) we have

"

--
Gerry

Gerry Jackson

unread,
Jan 8, 2018, 3:20:34 AM1/8/18
to
On 07/01/2018 11:32, Mark Wills wrote:
> So, in its purest sense, Forth is indeed syntax-less, but there are some
> convenience features, macros, that do have some syntax requirements.
>
> Forth itself has no syntax in the same way as machine code has no syntax.

I think that isn't correct. From Wikipedia:
https://en.wikipedia.org/wiki/Syntax_(programming_languages)
we have:

"In computer science, the syntax of a computer language is the set of
rules that defines the combinations of symbols that are considered to be
a correctly structured document or fragment in that language."

If a human, compiler or machine cannot group the symbols into meaningful
combinations how can it possibly understand a program and know what to
do. As Ron said the basic Forth syntax is space delimited words. I think
this can also be carried down to machine code where the symbols are 1's
and 0's, usually organised into bytes that a processor understands. The
machine abstraction, assembler, certainly has a syntax.

It's better to say that Forth has an extensible syntax or malleable syntax.

Even the statement about space delimited syntax isn't strictly true. For
example the following has no space before TYPE but is valid according to
the parsing rules of Forth:

s" This is valid Forth"type

--
Gerry

Gerry Jackson

unread,
Jan 8, 2018, 3:21:26 AM1/8/18
to
Ignore this, see my next post - I don't know how this slipped out!

--
Gerry

dxf...@gmail.com

unread,
Jan 8, 2018, 4:05:11 AM1/8/18
to
Forth certainly has rules of entry e.g. the form of a string constant
shall take. How is this not syntax? Furthermore users may extend the
compiler which amounts to more rules. OTOH it would be reasonable
to state forth's syntax is simple relative to some languages.

Ron Aaron

unread,
Jan 8, 2018, 4:11:47 AM1/8/18
to


On 01/08/18 11:05, dxf...@gmail.com wrote:
> On Monday, January 8, 2018 at 6:14:51 PM UTC+11, Ron Aaron wrote:

>> Well, yes: any specific *implementation* of Forth will have its own
>> syntax. But Forth /per se/ doesn't obligate a syntax.

> Forth certainly has rules of entry e.g. the form of a string constant
> shall take. How is this not syntax?

"Forth" has no rules regarding what form a string constant shall take.
ANS Forth does, but it's a standard (or a set of standards, if you
like). For that matter, I can imagine a Forth which doesn't allow
strings at all; say, in some very resource-constrained environment.

There's nothing about Forth which dictates that a string must be
delimited using S" ..." -- that's a common practice, but 8th (for
example) uses a "..." format like most common languages (yes, 8th does
have a syntax; and no, there's no space after the opening " symbol).

The layout of the string in memory is also not dictated, e.g. whether
it's a (addr,len) pair of cells or a byte-count single-cell pointer to a
buffer.


> Furthermore users may extend the
> compiler which amounts to more rules.

Yes... but how is that a *syntax* ?


> OTOH it would be reasonable
> to state forth's syntax is simple relative to some languages.

"Rudimentary" perhaps, rather than "simple". And "most", rather than
"some". At least, in my experience.

dxf...@gmail.com

unread,
Jan 8, 2018, 5:40:22 AM1/8/18
to
On Monday, January 8, 2018 at 8:11:47 PM UTC+11, Ron Aaron wrote:
> On 01/08/18 11:05, dxf...@gmail.com wrote:
> > On Monday, January 8, 2018 at 6:14:51 PM UTC+11, Ron Aaron wrote:
>
> >> Well, yes: any specific *implementation* of Forth will have its own
> >> syntax. But Forth /per se/ doesn't obligate a syntax.
>
> > Forth certainly has rules of entry e.g. the form of a string constant
> > shall take. How is this not syntax?
>
> "Forth" has no rules regarding what form a string constant shall take.
> ANS Forth does, but it's a standard (or a set of standards, if you
> like). For that matter, I can imagine a Forth which doesn't allow
> strings at all; say, in some very resource-constrained environment.

I equate syntax with rules and the best known rule of forth is
objects or numbers separated by spaces. I can't imagine a language
with no rules. Perhaps you can explain what you mean by syntax.

Anton Ertl

unread,
Jan 8, 2018, 11:36:32 AM1/8/18
to
Ron Aaron <ramb...@gmail.com> writes:
>My point is, rather simply, that implementing a "Forth" does not require
>one to implement any particular words, nor any particular syntax
>excepting the whitespace-delimited parser (and a dictionary, but that's
>internal).

But what was the point of the person you replied to?

Concerning your point, it's about the (minimal) definition of Forth.
I don't think that discussing this is very productive, but anyway:

In Chuck Moore's first paper on Forth [moore&leach70], Forth did not have the
space-delimited syntax that it has now.

Also, Forth is usually defined as having stacks, so Poial's
observation about stack effect syntax consituting a syntax applies.

@TechReport{moore&leach70,
author = "Charles H. Moore and Geoffrey C. Leach",
title = "FORTH -- A Language for Interactive Computing",
institution = "Mohasco Industries, Inc.",
year = "1970",
address = "Amsterdam, NY",
url = "http://www.ultratechnology.com/F70POST.ZIP",
url = "http://www.ultratechnology.com/4th_1970.html",
annote = "Describes Forth, as it was in 1970. There are
surprising differences from and surprising
similarities with modern Forth systems. The system
they describe uses text interpretation instead of
threaded code for definitions, although there is
already a code field, i.e., the foundation for indirect
threading. During the interpretation of a
definition, only words defined earlier are visible,
like in modern Forths, and in contrast to
Postscript. To make text interpretation speed
bearable, the dictionary is implemented as a hash
table with external chaining. There is support for
portably generating CODE words (called verbs in the
paper). The syntax is a bit more complicated than
today: special characters may only come as first
character in a word, so words are not only separated
by spaces. The system already features multitasking
(round-robin, with preemption). Source is stored in
screens (then called sheets) containing 50 lines by
40 characters. The programs look markedly different
than today because the primary stack manipulation
words are @T (similar to PICK) and =T (similar to a
word sometimes called STICK). Forth was running on
the IBM~1130 and the Burroughs B-5500 (different
cell sizes). The paper also observes that compactness of
programs ``arises through the economies of tailoring
definitions to a specific application'', and is more
pronounced in larger programs."

dxf...@gmail.com

unread,
Jan 8, 2018, 6:42:03 PM1/8/18
to
In that case it would be more meaningful to say there is no 'forth' - rather
a multiplicity of them, each having their own syntax. While there have
been attempts to forge a common syntax over the years, it has proven easier
to argue for than achieve :)

JennyB

unread,
Jan 9, 2018, 5:29:41 AM1/9/18
to
On Sunday, 7 January 2018 08:40:33 UTC, Ron Aaron wrote:
> On the Facebook Forth group, it was opined that Forths do have a syntax
> (despite the oft asserted "Forth has no syntax"), and that the syntax
> includes IF...ELSE...THEN. "Firstly there's the fundamental syntax of
> words separated by white space. Beyond that there's the : ... ;
> definition syntax, the IF ... ELSE .. THEN and various LOOP syntaxes. "
>
> I responded that "It's more correct to say that, apart from
> whitespace-delimited words, there's no required syntax. A Forth doesn't
> have to implement the ANS wordset, so "IF...ELSE...THEN" might not
> necessarily be part of a specific Forth implementation."
>

I'd say IF ... ELSE ... THEN are important to have if you want to use code written for other Forths, because they are hard to write without what Wil Baden used to call 'carnal knowledge.'

Going the other way, though - if for example you are addicted to an xt-passing style, you could write:

: xtIF ( f xt -- ? ) SWAP IF EXECUTE ELSE DROP THEN ;
: xtELSE ( f xt1 xt2 -- ? ) ROT IF DROP ELSE NIP THEN EXECUTE ;

and never use IF ... ELSE ... THEN ( and possibly [IF] [ELSE] [THEN] ) again

There is no real dividing line between a program written in Forth and a language written in Forth.

The beauty and the weakness of Forth is that a word does not need to know or care how what is on the stack got there.


Gerard Sontag

unread,
Jan 10, 2018, 12:58:00 PM1/10/18
to
Le dimanche 7 janvier 2018 09:40:33 UTC+1, Ron Aaron a écrit :

> ...
> What do you think?

I think you're right!
Having a look at any interpreter we will see there is no special test for 'IF' 'THEN' 'ELSE' and no more others words.
Syntax is simple as get a-white-space-delimited-string if it's a word execute it
ifnot is it a number if yes push it
ifnot signal-error
Don't blame me for this simple implementation

For me this 'is' the implementation of the syntax of Forth that's all.

What is creating a kind of 'syntax' is the behaviour of the word executed.
As soon as there is a 'standard' there is a 'syntax'.

Even if the grammar of what is a number is well defined in the ANS Forth, a lot of people developped their own kind of number creating a new syntax for numbers.

A lot of people here create their own Forth with their own syntax ( and sometime try to include it in a new standard, ... and this is where fire start).

The question is: does Forth need a standard? (Hey it's a joke please forget)
Gérard




a...@littlepinkcloud.invalid

unread,
Jan 10, 2018, 1:39:03 PM1/10/18
to
Gerard Sontag <gerard...@gmail.com> wrote:

> The question is: does Forth need a standard? (Hey it's a joke please
> forget)

But srsly... yeah. We need something, otherwise we don't even know
for sure what OR means. :-)

Andrew.

Alex

unread,
Jan 10, 2018, 1:39:09 PM1/10/18
to
On 10-Jan-18 17:57, Gerard Sontag wrote:
> Le dimanche 7 janvier 2018 09:40:33 UTC+1, Ron Aaron a écrit :
>
>> ... What do you think?
>
> I think you're right! Having a look at any interpreter we will see
> there is no special test for 'IF' 'THEN' 'ELSE' and no more others
> words. Syntax is simple as get a-white-space-delimited-string if it's
> a word execute it ifnot is it a number if yes push it ifnot
> signal-error Don't blame me for this simple implementation
>
> For me this 'is' the implementation of the syntax of Forth that's
> all.

Well, it falls short in that the simplest interpreter loop is a bit more
complicated than that. It uses the IMMEDIATE flag from FIND and STATE to
determine if the word is executed (IMMEDIATE or STATE=0) or compiled
(STATE<>0).

>
> What is creating a kind of 'syntax' is the behaviour of the word
> executed. As soon as there is a 'standard' there is a 'syntax'.

The behaviour or action of the word is normally called its semantics.
The syntax is to do with the tokens of the language (in the Forth case,
white space delimited words).

--
Alex

minf...@arcor.de

unread,
Jan 10, 2018, 3:54:11 PM1/10/18
to
Am Mittwoch, 10. Januar 2018 19:39:09 UTC+1 schrieb Alex:
> On 10-Jan-18 17:57, Gerard Sontag wrote:
> > Le dimanche 7 janvier 2018 09:40:33 UTC+1, Ron Aaron a écrit :
> >
> >> ... What do you think?
> >
> > I think you're right! Having a look at any interpreter we will see
> > there is no special test for 'IF' 'THEN' 'ELSE' and no more others
> > words. Syntax is simple as get a-white-space-delimited-string if it's
> > a word execute it ifnot is it a number if yes push it ifnot
> > signal-error Don't blame me for this simple implementation
> >
> > For me this 'is' the implementation of the syntax of Forth that's
> > all.
>
> Well, it falls short in that the simplest interpreter loop is a bit more
> complicated than that. It uses the IMMEDIATE flag from FIND and STATE to
> determine if the word is executed (IMMEDIATE or STATE=0) or compiled
> (STATE<>0).

The simplest solution: ban the word IMMEDIATE and all dual-semantic problems
are solved.


Alex

unread,
Jan 10, 2018, 5:27:33 PM1/10/18
to
Better to ban STATE.

--
Alex

Jan Coombs

unread,
Jan 11, 2018, 5:11:36 AM1/11/18
to
On Wed, 10 Jan 2018 22:27:31 +0000
Alex <al...@rivadpm.com> wrote:

> Better to ban STATE.
>
> --
> Alex

Didn't John Doty's forth like language (LSE?[1]) uses execution
state only? So it would compile the entered text, then execute
it, rather than having an interpret state.

I've not been able to spot any disadvantages with this approach
yet.

Jan Coombs
--

[1]
https://groups.google.com/forum/#!topic/comp.lang.forth/ErIrZI5ez8U

Gerard Sontag

unread,
Jan 11, 2018, 8:32:59 AM1/11/18
to
Le mercredi 10 janvier 2018 19:39:09 UTC+1, Alex a écrit :
> On 10-Jan-18 17:57, Gerard Sontag wrote:
> > Le dimanche 7 janvier 2018 09:40:33 UTC+1, Ron Aaron a écrit :
> >
>...
> Well, it falls short in that the simplest interpreter loop is a bit more
> complicated than that. It uses the IMMEDIATE flag from FIND and STATE to
> determine if the word is executed (IMMEDIATE or STATE=0) or compiled
> (STATE<>0).
I sais please don't blame me ;^)

> ...
> The behaviour or action of the word is normally called its semantics.
> The syntax is to do with the tokens of the language (in the Forth case,
> white space delimited words).
>
> --
> Alex
May i say you agree with Ron?

So is Forth a language or a super FSM with the ability to create and modify states in the meaning of a FSM.

Gérard

john

unread,
Jan 11, 2018, 9:03:35 AM1/11/18
to
In article <608149fc-bdb5-4217...@googlegroups.com>,
gerard...@gmail.com says...
>
> > ...
> > The behaviour or action of the word is normally called its semantics.
> > The syntax is to do with the tokens of the language (in the Forth case,
> > white space delimited words).
> >
> > --
> > Alex
> May i say you agree with Ron?
>
> So is Forth a language or a super FSM with the ability to create and modify states in the meaning of a FSM.
>
> Gérard
>
>

I dont know if the introduction on this page is any help working out what is what
but some may find it interesting.

https://labraj.feri.um.si/lisa/manual-concepts.htm


--

john

=========================
http://johntech.co.uk
=========================

Mark Wills

unread,
Jan 12, 2018, 7:06:28 AM1/12/18
to
On Sunday, 7 January 2018 08:40:33 UTC, Ron Aaron wrote:
> On the Facebook Forth group, it was opined that Forths do have a syntax
> (despite the oft asserted "Forth has no syntax"), and that the syntax
> includes IF...ELSE...THEN. "Firstly there's the fundamental syntax of
> words separated by white space. Beyond that there's the : ... ;
> definition syntax, the IF ... ELSE .. THEN and various LOOP syntaxes. "
>
> I responded that "It's more correct to say that, apart from
> whitespace-delimited words, there's no required syntax. A Forth doesn't
> have to implement the ANS wordset, so "IF...ELSE...THEN" might not
> necessarily be part of a specific Forth implementation."
>
> And I think I'm correct, since there are in fact
> "minimal-instruction-set" Forths which are nevertheless considered Forths.
>
> What do you think?

Going back to the original question: Is a Forth without IF...THEN a Forth?

Yes. But not a very friendly one.

dxf...@gmail.com

unread,
Jan 13, 2018, 4:29:42 AM1/13/18
to
At what point then do you stop calling something
'Forth'? CM referred to ANS-Forth as describing
'another language having the same name'.
0 new messages