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


Groups > comp.lang.forth > #22749

Re: The most elegant Forth interpreter.

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: The most elegant Forth interpreter.
Date 2013-05-17 19:02 -0700
Organization Nightsong/Fort GNOX
Message-ID <7xhai111wk.fsf@ruckus.brouhaha.com> (permalink)
References (4 earlier) <517e4c3e$0$6364$e4fe514c@dreader35.news.xs4all.nl> <7xd2tdpczx.fsf@ruckus.brouhaha.com> <klmom1$ln5$1@speranza.aioe.org> <r5-dncwRSu0GZ-PMnZ2dnUVZ_tOdnZ2d@supernews.com> <f5b9ffec-71bb-4ef9-ad67-9e18e9803fa8@googlegroups.com>

Show all headers | View raw


dirk.bruehl@usa.net writes:
> Is there any tutorial showing how changing from direct-threaded code
> to byte-token threading works?

I think the basic idea is:

- change the address interpreter into a bytecode interpreter.  For
example, assign a 1-byte code to the 128 most commonly used words
(numbering them 0-127 so that they fit in 7 bits of the byte).

- Modify the compiler to also recognize those words and emit those
codes.  For the less common words, emit two bytes: the first one
with the high bit set, and the remaining 15 bits used for the
actual address of the word.  That lets you address up to 32k.

> Now I am looking for an opportunity to change 4E4th to byte-token
> threading.  I never wrote my own Forth.

I don't know if the approach is that useful for 4e4th given the amount
of native machine code in camlforth, and the quite limited memory of the
430/2553 processor even by Forth standards.

The MSP430 Launchpad itself is no longer as attractive as it used to be
either.  For one thing, its price has more than doubled, so 4e4th would
have to change its name (if not its abbreviation).  There are now a
number of comparably cheap but somewhat more flexible ARM boards that
would make better targets, from Freescale and STM and others as well.

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


Thread

Re: The most elegant Forth interpreter. dirk.bruehl@usa.net - 2013-05-16 18:24 -0700
  Re: The most elegant Forth interpreter. Paul Rubin <no.email@nospam.invalid> - 2013-05-17 19:02 -0700
    Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-17 21:33 -0700
      Re: The most elegant Forth interpreter. Paul Rubin <no.email@nospam.invalid> - 2013-05-17 22:32 -0700
        Re: The most elegant Forth interpreter. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 07:50 -0500
          Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-18 10:56 -0700
            Re: The most elegant Forth interpreter. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 13:38 -0500
              Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-18 12:49 -0700
                Re: The most elegant Forth interpreter. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-19 04:12 -0500
                Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-19 13:58 -0700
                Re: The most elegant Forth interpreter. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-20 04:01 -0500
        Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-18 10:47 -0700
          Re: The most elegant Forth interpreter. Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-19 01:23 +0200
        Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-18 18:44 -0700
          Re: The most elegant Forth interpreter. Paul Rubin <no.email@nospam.invalid> - 2013-05-19 20:41 -0700
            Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-19 23:25 -0700
      Re: The most elegant Forth interpreter. "Bill Leary" <Bill_Leary@msn.com> - 2013-05-18 06:15 -0400
        Re: The most elegant Forth interpreter. visualforth@rocketmail.com - 2013-05-18 10:34 -0700
  Re: The most elegant Forth interpreter. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 05:30 -0500

csiph-web