Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Vocabularies Message-ID: <629.UUL1.3#5129@willett.UUCP> Date: 8 Mar 90 01:02:34 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 63 Category 3, Topic 18 Message 3 Wed Mar 07, 1990 R.BERKEY [Robert] at 01:07 PST Re: Interpretable numeral constants Dennis Ruffer writes, 900306: > Re: PETE KOZIAR > > Here's today's trivial speed-up. Three of the most-used > > constants are certainly -1, 0 and 1. F83 defined them as CODE > > words, but F-PC does not. > A warning is in order here. polyFORTH defined 0 and 1 as constants > for years. Recently, however, we implemented a way to revector the > number conversion and interpetation process. Under this system, it > is occasionally neccessary for 0 and 1 to pass through the number > conversion process. Then, defining numbers as constants can get you > into a lot of trouble. ... I've had problems with interpretable numeral constants, too, using F-PC. In response, I've created a NUMERALS vocabulary that is searched by the number compiler, during colon compilation. Once or twice I've tried to ' (tic) a numeral constant and forgotten for a moment that they weren't in the usual search order, but that's the only problem I can recall having. Most of work was going through the F-PC source code and changing the relevant literals to base-insensitive syntax, i.e., 10 to #10 or $0A . Then the reverse occurred when 3.5 came out and I used file compares to find out what was new, and each of those changes showed up as differences. Here are the words now in the NUMERALS vocabulary: >browser numerals these words --[ NUMERALS ]-- 2, 1, 0, #100 #60 #10 1K $200 $100 $0FF $80 $7F $40 $30 $20 $1F $18 $10 $0F $0A 9 8 7 6 5 4 3 2 1 0 -1 -2 Here's a note from the file, CONSTANTS, which includes '0' and '~' along with 17 other ascii-value constants: \ 890902 Constants save $90 segments, i.e., \ #2300 bytes, in the creation of FORTH.EXE I asked Tom Zimmer about constants, and he asserted that in-line constants are faster on an 8088. I think it was Mark Smiley he cited as someone who had encountered a problem with interpreting numerals defined as constants. As for speed, I'm using an 80286, and use the push immediate opcode to define constants. This along with identifying 2CONSTANTs adds several tests to the decompiler, as code fields are not as easy to interpret, but it all seems to have worked out. ----- 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'