GEnie@willett.UUCP (ForthNet articles from GEnie) (12/19/89)
Date: 12-17-89 (09:38) Number: 328
To: JERRY SHIFRIN Refer#: 326
From: IAN GREEN Read: NO
Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE
Yes that is the idea I was looking for. That and examples of code
relative to the syntax charts.
>Actually, for reasons which are beyond me, CH Ting did do a BNF
>for Forth. You can find it in his FORTH Notebook from Offete
>Enterprises or in the 2/82 issue of Dr. Dobb's. As near as I can
>tell, the BNF description of Forth should be something like:
<word> ::= (<non-blank character> ... )
<Forth program> ::= { <Forth program> [<word> ...]}
If you or someone has the complete BNF syntax for Forth (I am
currently playing with L&Ps F83.COM). This I feel would go a long way
towards clarifying the way the language works.
To be more in keeping with EBNF I would suspect that that Forth would
be defined something like:
Program := { Word }
Word := ":" Identifier { Word | Number } ";"
: :
: :
The problem is though I can write the syntax for a familiar language
fairly easily Forth is not so easily figured out.
Thanks, Ian Green
NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886
------------
-----
This message came from GEnie via willett through a semi-automated program.
Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'files@willett.UUCP (Mailed File Repository) (12/20/89)
Date: 12-18-89 (23:34) Number: 332 (Echo)
To: IAN GREEN Refer#: 328
From: SYSOP (ECFB/SHIFRIN) Read: NO
Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE
IG> If you or someone has the complete BNF syntax for Forth (I am
IG>currently playing with L&Ps F83.COM). This I feel would go a long way
IG>towards clarifying the way the language works.
Actually, Ian, the point I was trying to make is that Forth isn't
usually willing to sit still long enough for someone to develop a
detailed syntax. <grin>
By that I mean that every Forth token is eligible for
redefinition and may alter the syntax of itself and subsequent
string. For example, Forth programs may redefine or add IF or DO
type control sructures, may redefine constants e.g.
99 CONSTANT 5 \ 5 now means 99!
can even redefine existing functions in terms of themselves e.g.
: DUP DUP ." DUPing " . CR DUP ; \ Trace uses of DUP
and, in fact, can even redefine defining words like
: CONSTANT CREATE ! DOES> @ DUP .S ;
: : : 1 #DEFS +! ;
which redefines colon in terms of itself and adds a little
counter.
So, while you could get a BNF description of typical usage, it
doesn't really define the language.
---
* QDeLuxe 1.10 #214sGEnie@willett.UUCP (ForthNet articles from GEnie) (12/21/89)
Date: 12-19-89 (14:45) Number: 333
To: JERRY SHIFRIN Refer#: 332
From: IAN GREEN Read: NO
Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE
To be more clear what I guess I want is a EBNF of the primitives for
Forth, not the whole show. After all Forth, as I understand it, is built
up from a small set of static words. These are what I need defined, not
an extended (obese) implementation.
NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886
-----
This message came from GEnie via willett through a semi-automated program.
Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)
Date: 12-22-89 (00:42) Number: 335 (Echo) To: IAN GREEN Refer#: 333 From: SYSOP (ECFB/SHIFRIN) Read: NO Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE IG> To be more clear what I guess I want is a EBNF of the primitives for IG>Forth, not the whole show. After all Forth, as I understand it, is built Ian, none of the Forth primitives affects the syntax of the language, believe it or not. The closest we get at the primitive level is BRANCH and 0BRANCH which is typical, but non-standard, or MARK and RESOLVE which is semi-standard. None of these actually imposes a syntax, though they each can affect or imply a flow of control. For this to approach making sense, you have to understand that most Forths implement a virtual machine, one part of which is typically the IP or instruction pointer. The traditional Forth "inner interpreter" modifies the IP based on words like BRANCH which carry along an address offset. Does any of this help? probably not. --- * QDeLuxe 1.10 #214s ----- This message came from GEnie via willett through a semi-automated program. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'
ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)
Date: 12-22-89 (17:32) Number: 341
To: JERRY SHIFRIN Refer#: 335
From: IAN GREEN Read: NO
Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE
Interesting. The reason for a formal definition is simple. This way
developers can design with a standard and be assured that code will run.
As it is now I have difficulty learning the language because no two
Forths a totally compatible with one another.
What I need is a clean clear formal standard in EBNF or other simular
gramnmar description. Perhaps if I get time I will try to develope my
own formal definition and work from there.
Perhaps a good place to start would be to define a Forth machine
standard that can execute Forth instructions. The question is what is
needed? Is this OK?
TYPE ForthCPU = RECORD
CC: CARDINAL; (* condition code register *)
IP: CARDINAL; (* Instruction pointer *)
RS: CARDINAL; (* return stack *)
DS: CARDINAL; (* data stack *)
END;
My question is this. What other 'registers' do I need?
After that what are the bare minimum words that the 'machine' has to
know? (execute)
From there other words can be added in terms of the original 'machine'
instructions. This is the idea I think is best. Comments?
NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886
-----
This message came from GEnie via willett through a semi-automated program.
Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)
Date: 12-23-89 (14:21) Number: 342 (Echo) To: IAN GREEN Refer#: 341 From: SYSOP (ECFB/SHIFRIN) Read: NO Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE IG>After that what are the bare minimum words that the 'machine' has to IG>know? (execute) The point is that the syntax of Forth is trivial; it's the semantics of a handful of words which make Forth Forth. I think Chuck once proposed a dozen or so words as the minimum necessary, perhaps in a file here, but I don't recall for certain. --- * QDeLuxe 1.10 #214s ----- This message came from GEnie via willett through a semi-automated program. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'
ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)
Date: 12-24-89 (09:26) Number: 349 To: JERRY SHIFRIN Refer#: 342 From: IAN GREEN Read: NO Subj: LANGUAGE OF ANS FORTH Status: PUBLIC MESSAGE >IG>After that what are the bare minimum words that the 'machine' has to >IG>know? (execute) > >The point is that the syntax of Forth is trivial; it's the >semantics of a handful of words which make Forth Forth. I think >Chuck once proposed a dozen or so words as the minimum necessary, >perhaps in a file here, but I don't recall for certain. Perhaps you could list the words I need to start up the project. I will of cource need the corresponding semantics for each word. The goal is to write a Forth (minimal) in Modula-2 so that I can ultimately understand what makes Forth what it is. At the same time it would be reasonable simple (one the kernal is implementated) to move the implemenattion over to another platform. I guess by now you realize I am not much of a Forther so I often ask what maye be stupid questions. Still I am a good programmer, I just haven't made it very far down the Forth learning curve. NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886 ----- This message came from GEnie via willett through a semi-automated program. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'