[bootstrappable] Re: Bootstrapping from a hex editor

  • From: Eric Bavier <ericbavier@xxxxxxxxxxxxxxx>
  • To: Ondřej Čertík <ondrej@xxxxxxxxx>
  • Date: Tue, 17 Oct 2017 17:45:35 -0400 (EDT)

Hello Ondrej,

Sorry for the delayed response:

----- Original Message -----

Hi Eric,

On Fri, Oct 6, 2017, at 12:16 PM, Eric Bavier wrote:
Hello Ondrej,

Thank you for the discussion.

On October 6, 2017 10:38:07 AM CDT, "Ondřej Čertík"
<ondrej@xxxxxxxxx>
wrote:

2) Is it simpler to implement Lisp in assembly or Lisp in
Forth?
If it's simpler in Forth, which it might be, then perhaps it
is
worth
maintaining Forth, as an intermediate language between Lisp
and
assembly, even if overall it would be simpler to just maintain
Lisp
in
assembly, because there are lots of Forth tutorials out there,
and
so
more people might be able to help with a Lisp implementation
in
Forth.

I will maintain the stage0 FORTH as long as anyone feels it will
be
useful.
My hope is Lisp programmers will take my primitive lisp written
in
assembly and
use it only once to bootstrap a better lisp, written in lisp.

I kind of gave up, since I don't have the time to implement
Lisp in
Forth, and that's a lot of work.
Actually you could get it done in around 80ish hours of work.
But your hard work would be more beneficial writing FORTH
extending
or
leveraging our expanded FORTH.

There is very little to gain from throwing away the work that
has
already
been done.
I will assist any FORTH developer who wishes to contribute to
the
stage0
bootstrap (patches are always welcome)
But as a man to spent far too long writing programs in commented
Hex,
trust me when I say the lisp is fine but intentionally
primitive.

So please play with our expanded lisp and FORTH, find what we
have
missed
and feel free to create anything you think will improve the
bootstrap
or
secondary bootstraps.

Thanks. Just to make sure, I am not suggesting in any way that you
throw
away any of the hard work you have done. I am just trying to
understand
what's the best way to achieve bootstrap and whether to bother
with
Forth at all. It is currently unclear to me.

I have off and on been playing with implementing a C compiler in
Forth.
As a proof-of-concept I did the Rosetta Code "compiler" task in
Forth.
http://rosettacode.org/wiki/Compiler and repository at
https://notabug.org/bavier/rosetta-code-compiler-forth.  Though
that
implementation runs on gforth, I tried to use only words that are
already
in stage0 forth or would be easy to port.

I haven't had time yet to expand this towards full C, but you seem
interested, so I thought I'd mention it.

I looked into your code, it looks very impressive. What needs to be
done
in order to compile TinyCC?

I'm glad.  This was really just an exercise for me; the code is nowhere
close to being able to compile serious/real C code.  Note the RosettaCode
task is to implement a stripped-down C-like language.  E.g. it doesn't
have a preprocessor, or types, or structs, or for-loops, etc.  So those
are all things that would need to be done yet for a real compiler.

I also tried to run your code myself, but ran into some issues:

https://notabug.org/bavier/rosetta-code-compiler-forth/issues/1

Thanks for trying it.  I responded to your issue; I hope it helps.

-- 
`~Eric

Other related posts: