[comp.lang.forth] How Do Vocabularies Operate?

marmar@mtk.UUCP (Mark Martino) (04/05/89)

Is the concept of vocabularies essential to FORTH?  What do they do?
How does one implement vocabularies?  What does the mechanism look
like inside?  "Starting Forth" gives a good explanation, but I'm
still confused about some of the details.

Thanks for the help.

P.S.  Has anyone used the SC32 chip from Silicon Composers?  Has
anyone built a printer controller using Harris's RTX2000?

jax@well.UUCP (Jack J. Woehr) (04/09/89)

In article <417@mtk.UUCP> marmar@mtk.UUCP (Mark Martino) writes:
>Is the concept of vocabularies essential to FORTH?  What do they do?
>How does one implement vocabularies?  What does the mechanism look
>like inside?  "Starting Forth" gives a good explanation, but I'm
>still confused about some of the details.
>

	Vocabularies are not essential to Forth, but it is hard to imagine
Forth without them.

	Vocabularies serve to segregate words. There are two main reasons
one would want to do this:

	1) To make a turnkey system that only provided the user a limited
access to the power of the underlying system ( not very common anymore,
there are now target compilers for Forth that have generally pre-empted
this concept).

	2) To enable the system to posess several identical wordnames
with different code attached to them, the main use of vocabularies.
Examples: the OR in Forth, a bitwise operation on the two top stack
items, is quite a different beast than the OR in the ASSEMBLER vocabulary,
which compiles an OR  machine instruction into the dictionary; usage
by the metacompiler, where the meta version of words like CREATE supplement
the system version for the purpose of creating a target system.

	The vocabulary mechanism is just that there are several sets
of linkage available to the interpreter, depending on the search order.
All linked chains of definitions have to end somewhere, and the vocabulary
PFA holds the ends of the chains pertaining to it. By manipulating the
search order of the text interpreter , you determine what chain(s)
the interpreter will walk down looking for a dictionary match to the
item you just typed into the system.

	A good explanation of vocabularies is to be had in Dr.
C. H. Ting's book, _Inside F83_ Offete Press, 1306 South "B" Street,
San Mateo, CA 94402, $27.50 postpaid.


{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{}                                                                        {}
{} jax@well     ." Sysop, Realtime Control and Forth Board"      FIG      {}
{} jax@chariot  ." (303) 278-0364 3/12/2400 8-n-1 24 hrs."     Chapter    {}
{} JAX on GEnie       ." Tell them JAX sent you!"             Coordinator {}
{}                                                                        {}
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}

mef@aplcen.apl.jhu.edu (Marty Fraeman) (04/10/89)

In article <417@mtk.UUCP> marmar@mtk.UUCP (Mark Martino) writes:
>	... vocabularies question ...
>
>P.S.  Has anyone used the SC32 chip from Silicon Composers?  Has
>anyone built a printer controller using Harris's RTX2000?

My apologies for posting this, but my knowledge of the intricacies 
of mailers and such appears to be inadequate to send mail directly
to the poster from here.

If you have trouble getting answers to questions about the SC32 
feel free to contact me.  As part of the original design team I
ought to be able to feret out answers to technical questions.  
At JHU/APL we've now done three board level designs with the SC32
and have found them to be clean and easy to implement.  Since I 
did the external interfaces of the chip however I suppose I do 
have a little  bias -).


	Marty Fraeman

	mef@aplcen.apl.jhu.edu
	301-953-5000, x8360

	JHU/Applied Physics Laboratory
	Johns Hopkins Road
	Laurel, Md. 20707