What does HackerNews think of chibicc?

A small C compiler

Language: C

If a --k&r mode were to be reliable, wouldn't it need to get specified first? Otherwise people would start relying on some edge case.

If speed is not a requirement for the --k&r mode, you could just take the tis-interpreter and note that if it runs without UB, it is still much faster than an actual computer was when k&r were active.

Would it even be possible to specify a variant of C that contains no UB (e.g. would define exactly what happens on unaligned access), but can compile practical existing C89 programs? I wonder if it could be written such that it could actually specify the behaviour consistently across the language intersection supported by both of e.g. GCC 2.95 and Chibicc[0].

Or maybe there are so many bugs in GCC 2.95 that it would simply be infeasible? How much time would it take to specify?

[0]: https://github.com/rui314/chibicc

I was on the Eclipse Foundation call a few days ago regarding this topic and they said there was a well-established 3-part test for this in the EU courts. But I don't think I managed to take a screenshot, sorry.

Here is a snippet from the EU Blue Guide linked the from the Eclipse blog post:

"Commercial activity is understood as providing goods in a business related context. Non-profit organisations may be considered as carrying out commercial activities if they operate in such a context. This can only be appreciated on a case by case basis taking into account the regularity of the supplies, the characteristics of the product, the intentions of the supplier, etc. In principle, occasional supplies by charities or hobbyists should not be considered as taking place in a business related context."

I would consider GCC or React to fit this definition, while a hobby project like https://github.com/rui314/chibicc not to fit it.

Edit: I don't think you would have any obligations under CRA unless you make a project release available, whether commercially or on Github. The 3-part test I mentioned above only kicks in when there is a release of some sort in the first place.

chibicc: A Small C Compiler

  *) https://github.com/rui314/chibicc
  *) programming language used for the compiler: C
  *) emits assembly text (x86-64)
Yes, C can be simple for writing a compiler. [0][1]

No, optimisation, on the other hand, is not a simple problem.

[0] https://github.com/rui314/8cc

[1] https://github.com/rui314/chibicc

Great question. Here are some candidates:

* https://github.com/rswier/c4

* https://github.com/Fedjmike/mini-c

* https://github.com/rui314/8cc

* https://github.com/rui314/chibicc

* https://github.com/aligrudi/neatcc

Some of them are actually interpreters, and I personally would be interested in actual compilers that generate machine code.

Author here. These days I'm writing a new C compiler (https://github.com/rui314/chibicc) from scratch again to write a book about compilers.

Since I'll be using the new one as a reference implementation for a book, and the book is intended to be for beginners, I put as much effort as I can into improving the readability of the code. In particular, not only the head of the repository but every commit in the repo should be readable, so that readers can easily understand how each feature is implemented. I believe I'm doing a good job keeping it clean so far. (Actually in order to keep the commit history clean, I continue rewriting commit history and doing `git push -f`, but that should be fine because the purpose of publishing the repo is not for co-development but for sharing a reference implementation.)

chibicc does not have a C preprocessor, but except that it can compile itself already, so if you are interested, you can take a look.

I'm writing a new one (https://github.com/rui314/chibicc) and also writing a book about how to write a C compiler using my new compiler as a reference implementation.