Holy shit, Mes compiles tinycc now: lists.gnu.org/archive/html/gui

We may be well on our way to full bootstrappability of the GNU system!

Mes is a mutually self-hosting Scheme interpreter in C and C compiler in Scheme. It can compile itself both ways. Tinycc is known to compile earlier versions of gcc (before gcc went C++) so we have a path, finally, to building the entire GNU system from the bottom up.

I have no real understanding of what you are talking about, but it sure sounds great! :-) Perhaps, I'll understand some day! :-)

@arunisaac It's not so complicated! Four points to think about:

1) How do you compile a compiler?
2) The compiler you compile it with could possibly secretly insert hidden malware into the compiled compiler, which is propagated into the future by all later compilers.
3) Mes is very small and pretty easy to audit. And how does mutual self-hosting help?
4) Guix right now requires an initial set of binaries to "bootstrap" the system. Could we get rid of that with Mes?

@cwebber @arunisaac I'm just curious how you have enough scheme to compile a C compiler. Or is scheme at the boot / OS level?

@craigmaloney @arunisaac You implement a C compiler in Scheme! And that's what nyacc is, which is bundled with Mes. So all you need is a minimal Scheme implementation that's just-good-enough to be able to run the C compiler, written in scheme. Now use that to compile a better C compiler (tinycc) and use that to compile GCC... and you're off to the races!

@clacke @craigmaloney @arunisaac I asked in , janneke says:

- nyacc is used by mes, but is now unbundled from it.
- nyacc is a C99 parser, ie C99 -> AST
- mescc is a C99 compiler, ie AST -> M
- mes is a scheme interpreter that can run mescc
- nyacc in an amazing parser generator framework that comes with an almost complete c99 parser and preprocessor

(Thanks janneke!)

@cwebber @arunisaac @clacke I need to ask what M1 is but I might do that in the guile channel itself. Thanks!

@clacke @arunisaac @cwebber figured it out: M1 is macro assembly (human-readable assembly that can then be turned into machine code).

Might be similar to GAS then, but it's essentially the level where the machine can easily digest it.

@craigmaloney @arunisaac @clacke That's interesting... I've searched for "m1 assembly" and got a bunch of links to guns :P "m1 macro assembly" isn't doing much better. Do you have any links I could look at?


@cwebber @clacke @arunisaac

I noticed it here:


Which I got to via here: gitlab.com/janneke/mes

"This C prototype will be rewritten in [[github.com/oriansj/stage0][sta]] M1"

I noticed that Parrot also had a M1 "phase" for code, which made me wonder if that was VM code or what-not (iirc Parrot uses a VM).

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!