Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: ANS TC Magnet for Interpreter Message-ID: <260.UUL1.3#5129@willett.UUCP> Date: 14 Jan 90 03:54:56 GMT Organization: Latest Link in ForthNet Chain (Pittsburgh, PA) Lines: 77 Category 10, Topic 24 Message 5 Sat Jan 13, 1990 R.BERKEY [Robert] at 17:29 PST To: Mitch Bradley Re: Context-Free Numeral Syntax MB> Of course, Forth really ought to have some way of explicitly MB> declaring the radix of an individual number. So far, so good. One of the single biggest annoyances I've encountered recently is being unable to read code because of the context sensitivity of BASE . MB> The consensus was that I should amend the proposal to instead MB> define Forth words H# and D# , which would be followed by a MB> space and the number. We'll see how this amended proposal MB> fares. As for H# and D# as prefix words, I can't tell that the committee isn't just putting you off: (1) These can easily enough be defined. (2) The association of 'D' with "double" compounds problematically its use for decimal. Precisely the name D# is used for interpreting the following string as a double number, and the FST standards offer no other way but prefix operators for double numbers in source code. I've come up with the Roman numeral 'X' for the ten of DECIMAL as a fix (only to discover other's using 'X' for hex!). (3) I've known about these prefix operators for some nine years now, but I've _never_ used them. (4) Did they agree that these words would be state smart? ;-) : H#12a4 ( -- $12A4 ) \ Define a constant a hard way STATE @ IF [H#] 12A4 POSTPONE LITERAL ELSE [ H# 12A4 ] LITERAL THEN ; IMMEDIATE MB> At the last ANSI meeting, I proposed that number syntax MB> should allow the prefixes H# , D# , O# , and B# ... MB> Thus you could write H#12a4 or D#5478 ... Back to standardizing H# and D# and B# and O# as a part of the number: Part of my negative response to this syntax would have to be that I haven't seen it before, but I think there is more to it. Are you claiming you use these? Can you say you like them? --- Single character syntax --- Indeed, do you know of more than one character ever having been used in any assembler, language, etc. It seems that any of the single characters " # % & or ' would suffice. For my own solution with F-PC I've not resisted the culturally-biased '$' for hex, and adopted '#' for decimal, i.e., $12A4 and #32 . It was work to go through and mark each number, but the effort was well worth it. In short, I've eliminated HEX and DECIMAL from application code. Guy Kelly's PC83 uses a logical relationship of "'" for octal and '"' for hex. I've heard that single character syntax has been in the San Diego systems since pre-FIG days (and there was such in the SuperForth/polyFORTH I used there). They wonder why the rest of us haven't caught on yet! Robert Berkey ----- 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'