Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #25465

Re: A Host of Interpreters (Part 1)

Date 2013-08-29 07:41 -1000
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Newsgroups comp.lang.forth
Subject Re: A Host of Interpreters (Part 1)
References <851c246a-73d0-4efd-aa00-d98b93952fca@googlegroups.com> <2013Aug29.155822@mips.complang.tuwien.ac.at>
Message-ID <MLKdnSHAHe0yGoLPnZ2dnUVZ_s-dnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 8/29/13 3:58 AM, Anton Ertl wrote:
> JennyB <jennybrien@googlemail.com> writes:
>> THE PROBLEM WITH XTs
>> At its simplest, an xt is a pointer into native machine code. Using :NONAME=
>> we can get an xt for a new colon definition, but we can't do the same for =
>> words defined using the new CREATE without more intimate knowledge of the h=
>> ost. Why not? Because these words need not only an xt to describe /what/ th=
>> ey do, but an address in data space to tell them /where/ to do it. The code=
>> to which their xt points may have the data address in-line or passed on th=
>> e return stack of a CALL or=85=20
>>
>> There is a way round, so long as you only need colon definitions to have EX=
>> ECUTEable xts:
>
> That's quite a big restriction, as the words >BODY, DEFER@ and DEFER!
> become pointless: They all work on xts of words that are not colon
> definitions.
>
> One way to solve your problem is pretty much the way that traditional
> Forth implementations have worked:
>
> The xt is the address of the code field, and the code field contains
> the code address of the native code (or, in your meta-interpreter, the
> host-xt of a word that implements the behaviour you want.
>
> The cell after the code field (or maybe two cells after, depending on
> how you implement DOES>) is the parameter field, which is the body of
> a CREATEd word, or may contain other data for CONSTANTs and other
> defining words.

Or, better still, the code in question is capable of starting by pushing 
on the stack the address of the data field of the object wherever it is. 
You don't need to specify implementation, and you certainly don't have 
to restrict xt's to colon definitions!

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

A Host of Interpreters (Part 1) JennyB <jennybrien@googlemail.com> - 2013-08-28 12:14 -0700
  Re: A Host of Interpreters (Part 1) Lars Brinkhoff <lars.spam@nocrew.org> - 2013-08-29 09:27 +0200
  A Host of Interpreters (Part 1) JennyB <jennybrien@googlemail.com> - 2013-08-29 04:00 -0700
  Re: A Host of Interpreters (Part 1) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-29 13:58 +0000
    Re: A Host of Interpreters (Part 1) "Elizabeth D. Rather" <erather@forth.com> - 2013-08-29 07:41 -1000
      Re: A Host of Interpreters (Part 1) JennyB <jennybrien@googlemail.com> - 2013-08-29 13:35 -0700

csiph-web