Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Vocabularies Message-ID: <675.UUL1.3#5129@willett.UUCP> Date: 19 Mar 90 02:52:26 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 66 Category 3, Topic 18 Message 7 Sun Mar 18, 1990 R.BERKEY [Robert] at 04:44 PST Re: Constant Numerals Chris Waters writes, 900312: > If you could, I'd like some more details about why you have > problems with these constants. It was involved with a colon-definition structure that contains a table of numbers. In order to allow comments in the table, the compiler/interpreter that created the table first searched the dictionary, and the search needed to fail to correctly compile the number. To complicate things, that particular implementation is gone. There's now an INTERPRETERS vocabulary that contains, among others, the ( and \ words. That vocabulary is used to advance the input stream pointer over the comments. So I may not currently need NUMERALS . > It can't be something as simple as multiple stacks or floating > point, can it? I'm just curious why there isn't an easier > solution to this. The NUMERALS implementation can be simple. It adds one vocabulary to the compiler search order, without affecting the normal search order. An essential element is a word that searches a single vocabulary. As an example, the following code adds ['] NUMERALS ACQUIRE to the guts of a colon compiler. Both the inputs and the outputs of ACQUIRE are the same as the outputs from FIND . #SP WORD FIND ( a1 false | compilation-token flag ) ['] NUMERALS ACQUIRE \ if the flag is non-zero, the search is \ bypassed. Otherwise, search NUMERALS for \ the string at a1. Outputs are the same as \ FIND ?DUP IF 0> IF EXECUTE ELSE X, THEN ELSE NUMBER DOUBLE? IF [COMPILE] DLITERAL ELSE DROP [COMPILE] LITERAL THEN THEN Chris, It looks as if you're right around the corner, relative to ForthNet land. I can be reached in Fremont at (415) 659-1334 x352. Robert ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'