Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!well!jax From: jax@well.UUCP (Jack J. Woehr) Newsgroups: comp.lang.forth Subject: Re: How Do Vocabularies Operate? Summary: Quite well, actually ... Keywords: vocabularies, assembler, editor, metacompiler Message-ID: <11278@well.UUCP> Date: 8 Apr 89 22:46:00 GMT References: <417@mtk.UUCP> Reply-To: jax@well.UUCP (Jack J. Woehr) Distribution: usa Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 46 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 {} {} {} {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}