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


Groups > comp.lang.forth > #44026 > unrolled thread

Bootstrapping

Started byChris Curl <ccurl609@gmail.com>
First post2015-12-01 14:08 -0800
Last post2015-12-05 21:02 -0500
Articles 5 — 5 participants

Back to article view | Back to comp.lang.forth


Contents

  Bootstrapping Chris Curl <ccurl609@gmail.com> - 2015-12-01 14:08 -0800
    Re: Bootstrapping Paul Rubin <no.email@nospam.invalid> - 2015-12-01 14:31 -0800
    Re: Bootstrapping Lars Brinkhoff <lars.spam@nocrew.org> - 2015-12-02 08:04 +0100
      Re: Bootstrapping Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-12-02 11:53 +0000
    Re: Bootstrapping "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-12-05 21:02 -0500

#44026 — Bootstrapping

FromChris Curl <ccurl609@gmail.com>
Date2015-12-01 14:08 -0800
SubjectBootstrapping
Message-ID<5016c629-9407-42ae-80c0-eb2c1c178f83@googlegroups.com>
I feel like I'm making decent progress on my latest implementation,
an indirect threaded Forth written in C.

Might someone have a Forth bootstrap script that assumes (some number 
of) primitives are already defined? Ideally, such a script could build 
a working Forth by building on the primitives that are hand coded 
into the system.

Then an implementer could focus on the basic system and use the script
to get off the ground. A nice feature of that would be that it could
also be a smoke test for ANS compatibility.

[toc] | [next] | [standalone]


#44029

FromPaul Rubin <no.email@nospam.invalid>
Date2015-12-01 14:31 -0800
Message-ID<87bna9dcmx.fsf@jester.gateway.pace.com>
In reply to#44026
Chris Curl <ccurl609@gmail.com> writes:
> Might someone have a Forth bootstrap script that assumes (some number 
> of) primitives are already defined? Ideally, such a script could build 
> a working Forth by building on the primitives that are hand coded 
> into the system.

You should look at eforth.

[toc] | [prev] | [next] | [standalone]


#44036

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2015-12-02 08:04 +0100
Message-ID<86lh9dl4bb.fsf@vps34351.public.cloudvps.com>
In reply to#44026
Chris Curl wrote:
> Might someone have a Forth bootstrap script that assumes (some number 
> of) primitives are already defined? Ideally, such a script could build 
> a working Forth by building on the primitives that are hand coded 
> into the system.

Aren't most Forths implemented that way?  I.e. a few primitives written
in CODE or assembly language, and the rest built on top of those in
Forth.  The "script" in this scenario would be the metacompiler or an
assembler.

But this might be more what you're looking for:
https://github.com/16Bitt/forthstrap

Also, I'm sure Albert van der Horst can explain how his Forths are
generated with the m4 preprocessor.

[toc] | [prev] | [next] | [standalone]


#44041

FromAlbert van der Horst <albert@spenarnc.xs4all.nl>
Date2015-12-02 11:53 +0000
Message-ID<565edba6$0$23810$e4fe514c@news.xs4all.nl>
In reply to#44036
Lars Brinkhoff <lars.spam@nocrew.org> writes:

>Chris Curl wrote:
>> Might someone have a Forth bootstrap script that assumes (some number
>> of) primitives are already defined? Ideally, such a script could build
>> a working Forth by building on the primitives that are hand coded
>> into the system.

>Aren't most Forths implemented that way?  I.e. a few primitives written
>in CODE or assembly language, and the rest built on top of those in
>Forth.  The "script" in this scenario would be the metacompiler or an
>assembler.

>But this might be more what you're looking for:
>https://github.com/16Bitt/forthstrap

>Also, I'm sure Albert van der Horst can explain how his Forths are
>generated with the m4 preprocessor.

The more sophisticated tools (like m4) come in if you want to build
a family of Forth's using the same basic structure and if you want
to automate things to facilitate changes (in paticular tests and
documentation). If you accept the basic structure of ciforth you
can benefit from its setup, otherwise not so much.

Finding out how you want the basic structure is really what designing
a Forth is all about. Once you're done with that the rest is
straightforward. One shouldn't focus too much on what can be borrowed
in this second stage. In fact cut and paste from eForth, Brad Rodriguez
Forth's and fig-Forth's, maybe ciforth, serves this purpose.
Making a long division in ARM based on a long division in the 6809 is
not all that hard, but yone shouldn't have the illusion that it makes
sense to do that in high level Forth.

The hard part is knowing how you want your headers, terminal input,
interface with the OS, register assignment, looping, denotations
(numbers). If you can get these working together smoothly (and in
ciforth I'm still working on that) then you'll have good Forth.

Still you'll end up with one Forth that is a compromise based on a
focus. For ciforth the focus is introspection. Compare that with
gforth that focusses on compatibility and completeness.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#44096

From"Rod Pemberton" <boo@fasdfrewar.cdm>
Date2015-12-05 21:02 -0500
Message-ID<op.x8689npmyfako5@localhost>
In reply to#44026
On Tue, 01 Dec 2015 17:08:24 -0500, Chris Curl <ccurl609@gmail.com> wrote:

> I feel like I'm making decent progress on my latest implementation,
> an indirect threaded Forth written in C.
>
> Might someone have a Forth bootstrap script that assumes (some number
> of) primitives are already defined? Ideally, such a script could build
> a working Forth by building on the primitives that are hand coded
> into the system.
>
> Then an implementer could focus on the basic system and use the script
> to get off the ground. A nice feature of that would be that it could
> also be a smoke test for ANS compatibility.

Each system build from primitives uses a different set of them.

You could also look at fig-Forth.  Much of it is listed as high-level
Forth code.  Discard the Forth words no longer in use, or which were
dropped by later Forth standards, e.g., Forth-79, Forth-83, ANS-Forth.

eForth has already been mentioned.  This is the Forth renowned for
the technique of building up Forth from low-level primitives.

I implemented many words in C first, then slowly rewrote them
in high-level Forth.  Most of this was easy, but some of them
were difficult because high-level C is so much more powerful
than high-level Forth, especially things like pointers to pointer
to an element of an array, etc., which must be rewritten in
terms of very basic address manipulations, e.g, fetch @ and
store ! .


Rod Pemberton


-- 
How to kill Facebook.  Tell a bunch of fourth graders that
only old people use Facebook.  Wait eight years.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web