unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Rui Ueyama <rui314@gmail.com>
To: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: guile-user@gnu.org
Subject: Re: on using 8cc in reproducible bootstrap process
Date: Sun, 18 Jun 2017 15:39:38 -0700	[thread overview]
Message-ID: <CACKH++b5phC=eHq92xfaCE=tG8GLPK717LiiKS0tstKzkH6-aQ@mail.gmail.com> (raw)
In-Reply-To: <87d1a1csiw.fsf@gnu.org>

Hi Jan,

Thank you for your interest in 8cc. 8cc is indeed a C compiler that
supports most C11 features. However, I don't think it is being used
seriously by anyone, so honestly I'd doubt it is a good choice to be used
as part of your bootstrapping process. tcc have been much more tested.

The most interesting use of 8cc is to write a C++11 constexpr compile-time
C compiler <https://github.com/kw-udon/constexpr-8cc> which is built on top
of ELVM <https://github.com/shinh/elvm>, but that is still a toy program.

On Sun, Jun 18, 2017 at 6:52 AM, Jan Nieuwenhuizen <janneke@gnu.org> wrote:

> Hi!
>
> I am working to create a full source bootstrap path for GuixSD[0].  I
> have written Mes[1] a mutual self-hosting Scheme interpreter prototype
> in C and a C compiler (Mescc) in Scheme.
>
> The prototype Scheme interpreter in C will be redone in stage0's hex2[2]
> at an opportune moment which will give us a real simple C compiler
> (Mescc) that does not depend on any binary.
>
> The next leap forward is to compile gcc.  I have been looking at
> compiling Tinycc[3].  A couple of weeks ago, rain1 has been working with
> the tcc developers to succeed in compiling gcc using tcc[4].
>
> However, tcc uses many esoteric language features which makes
> bootstrapping using tcc pretty [unnecessarily?] difficult.
>
> That is why I was happily surprised to read about 8cc's advertised
> bootstrappability
>
>     8cc is a compiler for the C programming language. It's intended to
>     support all C11 language features while keeping the code as small
>     and simple as possible.
>
> However, I'm currently stuck on 8cc's use of anonymous unions and 8cc's
> anonymous structs in unions.  To me, as a fresh C compiler writer, those
> are pretty esoteric language features too.  The idea of having to
> implement those discourages me a bit.
>
> Do you think 8cc should be used in my efforts to create a full source
> bootstrap path (rather than tinycc, or as a stepping stone to tcc)?
>
> If so, I can think of two strategies
>
>   1) a. implement anonymous unions in Mescc
>      b. implement anonymous structs (inside anonymous unions) in Mescc
>   2) remove anonymous unions and structs from 8cc
>

That said, I don't think anonymous structs/unions are not that tricky. It
shouldn't be hard to support the feature. If it is the only missing feature
in your compiler, you might want to add that.


>
> which one would you advise, or do you have a better alternative?  Should
> I 1) learn about anonymous structs and make Mescc richer, or would you
> like to (help and) take patches for 2)?
>
> Greetings,
> janneke
>
> [0] https://gnu.org/s/guix
> [1] https://gitlab.com/janneke/mes
> [2] https://github.com/oriansj/stage0
> [3] https://bellard.org/tcc/
> [4] http://lists.nongnu.org/archive/html/tinycc-devel/
> 2017-05/msg00103.html
>
> --
> Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
> Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
>


      parent reply	other threads:[~2017-06-18 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 13:52 on using 8cc in reproducible bootstrap process Jan Nieuwenhuizen
2017-06-18 14:53 ` Mike Gran
2017-06-18 22:39 ` Rui Ueyama [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACKH++b5phC=eHq92xfaCE=tG8GLPK717LiiKS0tstKzkH6-aQ@mail.gmail.com' \
    --to=rui314@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=janneke@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).