Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!dwp From: dwp@willett.pgh.pa.us (Doug Philips) Newsgroups: comp.lang.forth Subject: Re: Postfixer FORTH Message-ID: <1599.UUL1.3#5129@willett.pgh.pa.us> Date: 24 Aug 90 05:05:59 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 75 In <9008230629.AA29489@ucbvax.Berkeley.EDU>, DAVID@PENNDRLS.BITNET writes: > I thought the assembler was Interpreted code in all systems? Is this > not true? So '"' is interactive and leaves on the stack the address of > a copy of the string up to the next '"', which 'Is' eats and lays down > the index entry, and then 'BX Push,' assembles the next instruction into > the dictionary, and so on. Oops. I forgot that. I guess the only difficulty might be if you were using a subroutine threaded system with an optimizer in it, such as Andrew Scott describes in the article "Extensible Optimizing Compiler" (Forth Dimensions, Volume XII, Number 2). I'm not sure what would happen to a label on an instruction that "disappeared". Maybe the label would just inhibit optimization "across it"? Probably just an academic question. > You are absolutely right about this. I take back my implication that > my Is construct is in any way superior to { code . . . } " name" Def. > It is in fact inferior (but easier, I think, to implament). You could use it in something perverted like: : Long-Word ( stuff ) [ " Short-Word" Is ] ( more stuff ) ; Of course that would require the dictionary to be out of the way of the code, a system dependant thing. On the other hand if you really need to tail merge two definitions you are doing non-portable stuff anyway. (I can't easily justify why you'd do something like the above instead of going to assembly code though.) > CODE: " 2Push" Is BX PUSH > CODE: " Next" Is AX PUSH > CODE: " 1Push" Is ( Machinations for NEXT... ) ;Code > > >place. Of course, in my example, I assume that CODE: doesn't do anything > >obnoxious like create a code prolog or do any alignment, etc. Of course > >those restrictions would apply equally to your example. > > I'm not sure why you say this. I am assuming Is does not compile > anything into the dictionary, but my Code: is free to lay down a CFA > and whatever code prefix it may find necessary, since it is called only > once, at the beginning of the Word. Only "2Push" could be referenced > as a FORTH word, the other two could only be used as assembly labels. > For that reason I don't really consider my example valid code. Ok. I guess I was still stuck on: > From: DAVID@PENNDRLS.BITNET > Message-ID: <9008152018.AA23733@ucbvax.Berkeley.EDU> > Date: 15 Aug 90 15:13:41 GMT > Reply-To: DAVID%PENNDRLS.BITNET@SCFVM.GSFC.NASA.GOV > > 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. -Doug --- Preferred: ( dwp@willett.pgh.pa.us OR ...!{sei,pitt}!willett!dwp ) Daily: ...!{uunet,nfsun}!willett!dwp [last resort: dwp@vega.fac.cs.cmu.edu] --- Preferred: ( dwp@willett.pgh.pa.us OR ...!{sei,pitt}!willett!dwp ) Daily: ...!{uunet,nfsun}!willett!dwp [last resort: dwp@vega.fac.cs.cmu.edu]