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


Groups > comp.lang.forth > #22751

Re: The most elegant Forth interpreter.

Newsgroups comp.lang.forth
Date 2013-05-17 21:33 -0700
References (5 earlier) <7xd2tdpczx.fsf@ruckus.brouhaha.com> <klmom1$ln5$1@speranza.aioe.org> <r5-dncwRSu0GZ-PMnZ2dnUVZ_tOdnZ2d@supernews.com> <f5b9ffec-71bb-4ef9-ad67-9e18e9803fa8@googlegroups.com> <7xhai111wk.fsf@ruckus.brouhaha.com>
Message-ID <c2ddf12d-0459-49d9-b3e4-c4dec88e9f24@googlegroups.com> (permalink)
Subject Re: The most elegant Forth interpreter.
From visualforth@rocketmail.com

Show all headers | View raw


On Friday, May 17, 2013 10:02:03 PM UTC-4, Paul Rubin wrote:
> dirk....@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.

Sorry, but that reminds me when I was told that changing the motor of the VW1200 it only needs to remove four screws. 

> 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).

I had this idea, too. I wrote a virtual engine in 1978 for the 6502 because I didn't like to type all these subroutine calls. Worked well because I had only 200 something subroutines.

> - Modify the compiler to also recognize those words and emit those
> codes.  

Part two of changing the motor by removing four screws.

> 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.

That's the trick I was looking for. I didn't find a solution to address more than 256 words only using one byte. That means, all application words will need 2 Bytes. That's interesting for portability, has some time penalty.

May be using vocabularies can extend the use of one byte codes?
 
> > Now I am looking for an opportunity to change 4E4th to byte-token 
> > threading.  I never wrote my own Forth.
And I never changed the motor of a VW1200.

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

Thanks for this praise of CamelForth!

On Monday, April 29, 2013 6:56:27 PM UTC-4, Andrew Haley wrote:
> I once ran out of code space in a microcontroller application.
> So, I changed from direct-threaded code to byte-token threading. 

That's why I asked for advice.

Paul, you are writing now "I don't know if the approach is that useful for 4e4th given ... the quite limited memory of the 430/2553 processor"
That's some kind of contradiction, I guess.
 
> 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).  

4E4th started as 4€-Forth - which was possible back then and a great opportunity a lot of educators took advantage of.

But as it was not possible to establish a http://www.4 €4th.eu website, so instead http://www.4e4th.eu was chosen, and 4E4th - Forth for Education was born. 

You can read the whole story at 
http://www.complang.tuwien.ac.at/anton/euroforth/ef12/papers/bruehl.pdf 

> 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.

You are welcome to join us and offer a free Forth for Education for these boards.

There are some requirements:
- There has to be a free flasher which can be integrated into the 4E4th-IDE.
- Programming has to be done directly to Flash.
- To synchronize target and IDE, some prompt extensions have to be made: for base recognition (needed for the cross-assembler) and for error recognition.

The 4E4th-IDE.exe - see http://www.4e4th-IDE.org - including Flasher, Editor and Cross-Assembler only needs 1MB on disk, much less than other IDEs (IAR needs 1GB on disk). 

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