Path: utzoo!utgpu!watmath!att!ucbvax!SUN.COM!wmb From: wmb@SUN.COM (Mitch Bradley) Newsgroups: comp.lang.forth Subject: Re: Forth in C (was Re: Forth from scratch) Message-ID: <8911170628.AA19935@jade.berkeley.edu> Date: 16 Nov 89 23:05:08 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Forth Interest Group International List Organization: The Internet Lines: 40 > >To add to the "Forth written in C debate" I wish to point out that, > >in UNIX, it is not _possible_ to write Forth (in either C _or_ > >assembler !!!) that can allow the user to write definitions in the > >native machine language (ie.e., assembler). > Tom Almy adds... > Not true! ... > There may be hardware constraints on specific machines coupled with > poor Unix implentation decisions that would make it impossible, > but it is not too likely -- All of my assembly language Unix Forth implementations have an interactive assembler. My C Forth 83 implementation, which runs under Unix and many other operating systems, does not come with an assembler, but some customers have written interactive assemblers which run under C Forth 83 and assemble code for their particular machine. (To do so requires knowledge of the particular C compiler's register allocation, but that information is easily obtained by disassembling the compiled code.) I have only heard of one instance where an interactive assembler was not routinely possible. That was on a Unix machine which did not allow the execution of machine instructions from the data segment. Even on that machine, there may have been some magic linker incantation which would have relaxed the restriction, but I did not look at the machine personally, so I can't say for sure. > if the implementation rules out Forth it is also ruling out Lisp! I'm not sure how this statement follows. One can certainly implement either Forth or LISP in such a way that code and data are kept strictly separate. Generating machine code "on the fly" may be a particularly efficient way to interpret or compile LISP, but it is not the only way. Even in a FIG-Forth-style Forth implementation, user-defined words Forth words are mostly "pure data". The exceptions are obviously CODE words, and perhaps not-so-obviously DOES> clauses. DOES> clauses can certainly be implemented without compiling machine code on-the-fly. Mitch