Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!ucbvax!PENNDRLS.BITNET!DAVID From: DAVID@PENNDRLS.BITNET Newsgroups: comp.lang.forth Subject: Re: Postfixer FORTH Message-ID: <9008180333.AA11956@ucbvax.Berkeley.EDU> Date: 17 Aug 90 19:43:12 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: DAVID%PENNDRLS.BITNET@SCFVM.GSFC.NASA.GOV Organization: The Internet Lines: 46 >> How about this for a more postfix FORTH syntax: >> >> " SomeWord" Is 20 Constant >> " *2" Is : 2 * ; >> >> 'Is' factors out Create without changing the compiler significantly. >> The Name field still gets laid down first. Defining words then >> lay down a Code field at the current location, which is >> conveniently right where it should go. >I was going to reply that I thought your 'Is' was actually infix and >not postfix. However, I think I'm too confused to say that with confidenc >The point of postfix is that parameters are passed to functions and that >the functions don't/shouldn't care how the parameters are created. >I think your 'Is' example shows that the physically adjacency of the >dictionary is not necessary are pure factoring. I agree with: > 20 Constant ( and ) > : 2 * ; >being words that lay down code somewhere. I think that for 'Is' to be >strictly postfix, the address of the code to be associated with the >word should be on the stack along with the name for the word. What I >think you have in your 'Is' is a form of deferred word that is >immediately resolved. Actually my logic was as follows: Is is a word that takes a string and builds an index entry that points to Here. Constant and : are 'defining words' that lay down a Code Field and Body. Remember that the index is not required for FORTH execution. The compiler looks up words in the Index and compiles the address to which the index entry points. Like data types in FORTH, it is the programmer's responsability to see to it that Is was called only to label an address where he or she subsequently put a Code Field. Is doesn't care, and neither does the compiler. In fact, if one were to define the system such that the index was located in a different area than the dictionary, one could use Is to label an arbitrary memory location, such as defining a label in an assembler program: " 2Push" Is Code: BX Push, " 1Push" Is AX Push, " Next" Is ..... ;Code (to crib an example from my memory of F83). But I agree with you: 'postfix' vs 'prefix' vs 'infix' seems to be a much subtler problem than I ever imagined! -- R. David Murray (DAVID@PENNDRLS.BITNET, DAVID@PENNDRLS.UPENN.EDU)