|
|
Up |
|
|
  |
Author: DavidMDavidM Date: Jun 28, 2008 05:23
Hi,
Does anyone know of a Forth implementation that:
- is written almost entirely in forth, save for the absolutely
smallest possible number of primitives
- has its handful of primitives written in highly portable C:
- can compile for 32-bit or 64-bit, little or big-endian
- is ANS compliant
- has a good C API, easy to add a small number of extra C
primitives
I've been working with FICL - it has around 12k lines of C - I'd be
curious to work with a Forth with only a few hundred (or even a few
dozen) lines of C.
Thanks in advance
Dave
|
| |
|
| | 26 Comments |
|
  |
|
|
  |
Author: foxchipfoxchip Date: Jun 28, 2008 16:03
On Jun 28, 5:23 am, DavidM nowhere.com> wrote:
> Does anyone know of a Forth implementation that:
>
> - is written almost entirely in forth, save for the absolutely
> smallest possible number of primitives
Minimal ANS Forth and eForth have a small number of primitives.
But there is a tradeoff with performance that drops off rather
steeply when the number of primitives drops below the minimal
practical number.
It is a little like asking what is the minimal instruction set.
It is an academic question not a practical one. In reality no
one uses the absolute minimum. eForth is more mature and more
complete than MAF and has a few more primitives. About 80%% of
code can easily consist of nothing but about 30 primitives and
when you drop below that code size will go up considerably and
performance will drop considerably.
> - has its handful of primitives written in highly portable C:
|
| Show full article (2.29Kb) |
| no comments |
|
  |
Author: Robert MillerRobert Miller Date: Jun 28, 2008 20:08
>
> Having implemented a couple of Forth's in C, it begs the question, just
> what is the minimal wordset with which you can bootstrap a Forth
> implementation? Is there any literature on this?
>
I don't know how relevant this might be to modern implementations, but about
thirty years ago the answer to that question was IIRC sixteen. We had been
looking at Forth for a 6809 based test system and our software guru (not me)
found a paper somewhere that identified the minimum wordset from which the
whole language could be built. It took him only a week to get a limited
version of FORTH up and running. MVP Forth was the model on which the
implementation was expanded. It was only another couple of weeks until the
whole language was implemented. Frequently used words were later recoded in
assembly language.
Bob
|
| |
| no comments |
|
  |
|
Author: OysterOyster Date: Jun 29, 2008 01:13
|
| |
| no comments |
|
  |
Author: The Beez'The Beez' Date: Jun 29, 2008 01:15
On 28 jun, 14:23, DavidM nowhere.com> wrote:
> I've been working with FICL - it has around 12k lines of C - I'd be
> curious to work with a Forth with only a few hundred (or even a few
> dozen) lines of C.
Well, 4tH is about 5.5K lines of code, but it was written as a
library, so take what you need. Furthermore, it was designed to be
highly portable and easily interface with C. Whether 16, 32 or 64 bit
- 4tH won't care.
It comes with a 100 page development guide, so changing it shouldn't
be a problem. There is even a mechanism to take your personal
enhancements from one version to the next.
http://www.xs4all.nl/~thebeez/4tH
Hans Bezemer
|
| |
| no comments |
|
  |
Author: spamspam Date: Jun 29, 2008 13:54
On Sat, 28 Jun 2008, Robert Miller wrote:
> I don't know how relevant this might be to modern implementations, but about
> thirty years ago the answer to that question was IIRC sixteen. We had been
> looking at Forth for a 6809 based test system and our software guru (not me)
> found a paper somewhere that identified the minimum wordset from which the
> whole language could be built. It took him only a week to get a limited
> version of FORTH up and running. MVP Forth was the model on which the
> implementation was expanded. It was only another couple of weeks until the
> whole language was implemented. Frequently used words were later recoded in
> assembly language.
>
> Bob
Any links to that paper? The question is not how many, but which ones?
|
| |
| no comments |
|
  |
Author: billybilly Date: Jul 1, 2008 07:29
foxchip ultratechnology.com> wrote:
> DavidM nowhere.com> wrote:
>> Does anyone know of a Forth implementation that:
>> - is written almost entirely in forth, save for the absolutely
>> smallest possible number of primitives
> It is a little like asking what is the minimal instruction set.
> It is an academic question not a practical one. In reality no
The absolute minimum number of instructions for a stack-based language
is two ( http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#jfp03).
Unfortunately, with that small of an instruction set there's no room
for numbers (although you can implement numbers as 'Church numerals').
Sorry, just heard the word "academic". Now _this_ is academic.
Definitely not practical.
I'm just finishing off a little interpreter (written in Python, sorry)
for such a language. Somewhat interestingly, it's more fun to program
in than Unlambda. (I'm afraid that establishes a very, VERY low level
of "fun to program".)
-Wm
|
| |
| no comments |
|
  |
Author: Coos HaakCoos Haak Date: Jul 1, 2008 08:20
Op 29 Jun 2008 00:23:55 +1200 schreef DavidM:
> Hi,
>
> Does anyone know of a Forth implementation that:
>
> - is written almost entirely in forth, save for the absolutely
> smallest possible number of primitives
> - has its handful of primitives written in highly portable C:
> - can compile for 32-bit or 64-bit, little or big-endian
> - is ANS compliant
> - has a good C API, easy to add a small number of extra C
> primitives
>
> I've been working with FICL - it has around 12k lines of C - I'd be
> curious to work with a Forth with only a few hundred (or even a few
> dozen) lines of C.
>
|
| Show full article (1.02Kb) |
| no comments |
|
  |
|
|
  |
Author: DavidMDavidM Date: Jul 1, 2008 13:04
On Sat, 28 Jun 2008 16:03:59 -0700, foxchip wrote:
> There is a version of eForth with primitives in C. You can combine
> those primitives with any other version of eForth you choose.
The eForth developer's site makes no mention of a C version. Google
searches are coming up blank. Do you know where I can find this C verison?
Cheers
Dave
|
| |
| no comments |
|
|
|
|