wmb@MITCH.ENG.SUN.COM (01/29/91)
> You might check with Martin Tracy. He wrote a mini-LISP in Forth > (complete with garbage collection) which would run, virtually without > change, on all the major Forth-83 systems. It worked on all these major Forth-83 systems because he *ported* it to all those systems before he released it, and he included a system-dependent "prelude" for each of those systems in the package. The individual preludes themselves were quite different, thought they implemented the same "top level" interface. I know because I ported his model library to one of the Forth 83 systems that he didn't include in the basic package. In fact, I happen to have copies of his LISTS package and his SPREADSHEET package right here. I think I'll have a look-see to find out what's in the preludes ... > It might be interesting to see if he thinks that something comparable > could be written to run on any ANS-Standard system. Well, let's see; the union of the preludes for the LISTS and SPREADSHEET programs contains the following words: Prelude Word ANS Equivalent ALIGN ALIGN REALIGN ALIGNED IBM_KEY EKEY IP@ " (see text) ALGEBRA+FORTH+CONTEXT SET-ORDER (see text) LAST-CODE START: (see text) IP@ is used only to implement the word " (double-quote), which ANS Forth already has. Martin's implementation of " in terms of IP@ is actually not portable to some Forth-83 systems (e.g. JForth, RTX2000), so standardizing at the " level is better anyway. ALGEBRA+FORTH+CONTEXT is used to establish a particular search order, which cannot be done portably in Forth-83, but can be done portably in ANS Forth. LAST-CODE is used only to get the CFA of a dynamically-compiled definition, and ANS Forth already has a word for that (START:). It looks to me like ANS Forth solves all the portability problems that Martin had to "sweep under the rug" with his version-dependent "preludes". So, I guess the answer to the question is, yes, it can be done in ANS Forth, and will run, not *virtually* without change, but *completely* without change, with no preludes and no need to instruct the user to select the correct prelude before compiling. > I'd also be interested in his assessment of the magnitude of the problem > of converting this kind of software from Forth-83 to ANS. This is an excellent question. I believe I'll take it as an action item and get back to you all with the answer. My guess is "piece of cake", but I'll have to get back to you with the "for certain" answer. Mitch Bradley, wmb@Eng.Sun.COM