SectorC: A C Compiler in 512 bytes
11–20 of 82 posts
Re: SectorC: A C Compiler in 512 bytes
#12Earlier quoted context omitted.
Without structs? Good luck...
LFS already has several "stepping stones" where it walks through a whole set of C compilers from very old ones compiling slightly newer / more capable ones and so on. Perhaps with a few more "layers of compilers" on top you can get a very early GCC going.
Applause. Best comment ;)
Re: SectorC: A C Compiler in 512 bytes
#13This reminded me the idea of compilers bootstrapping ( https://news.ycombinator.com/item?id=35714194 ). That is, now you can code in SectorC some slightly more advanced version of C capable of compiling TCC ( https://bellard.org/tcc/ ), and then with TCC you can go forward to GCC and so on.
https://guix.gnu.org/blog/2023/the-full-source-bootstrap-bui...
Re: SectorC: A C Compiler in 512 bytes
#14Re: SectorC: A C Compiler in 512 bytes
#15something like this could be interesting for deep-space applications where you only have a bare metal environment with hardened processor and limited memory & of course ping time of days (to earth). or alternatively for embedding a C compiler inside a LLM to use the LLM as a form of virtual machine.
A 512 byte memory restriction and deploying an LLM could not be on further opposite sides of the spectrum. :D
Re: SectorC: A C Compiler in 512 bytes
#16This reminded me the idea of compilers bootstrapping ( https://news.ycombinator.com/item?id=35714194 ). That is, now you can code in SectorC some slightly more advanced version of C capable of compiling TCC ( https://bellard.org/tcc/ ), and then with TCC you can go forward to GCC and so on.
Did you read about the guix full source bootstrap the other day? They've shrunk the bootstrap seed down to a 357-byte program: https://guix.gnu.org/blog/2023/the-full-source-bootstrap-bui...
All of this is incredible work, but a minimal C-subset compiler in under 512 bytes of x86 assembly seems like a unique achievement as it includes non-trivial parsing and linking phases not required for that hex0 interpreter.
Re: SectorC: A C Compiler in 512 bytes
#17This reminded me the idea of compilers bootstrapping ( https://news.ycombinator.com/item?id=35714194 ). That is, now you can code in SectorC some slightly more advanced version of C capable of compiling TCC ( https://bellard.org/tcc/ ), and then with TCC you can go forward to GCC and so on.
Did you read about the guix full source bootstrap the other day? They've shrunk the bootstrap seed down to a 357-byte program: https://guix.gnu.org/blog/2023/the-full-source-bootstrap-bui...
> Even more recently (2018), the GNU C Library glibc-2.28 adds Python as a build requirement
I’m surprised they went with Python and not GNU software (e.g. Guile).
Edit: clicking through the link it sounds like this might be intended to replace other accumulated dependencies (Perl?) and stop supporting old versions of Python.
Re: SectorC: A C Compiler in 512 bytes
#18This reminded me the idea of compilers bootstrapping ( https://news.ycombinator.com/item?id=35714194 ). That is, now you can code in SectorC some slightly more advanced version of C capable of compiling TCC ( https://bellard.org/tcc/ ), and then with TCC you can go forward to GCC and so on.
Re: SectorC: A C Compiler in 512 bytes
#19This reminded me the idea of compilers bootstrapping ( https://news.ycombinator.com/item?id=35714194 ). That is, now you can code in SectorC some slightly more advanced version of C capable of compiling TCC ( https://bellard.org/tcc/ ), and then with TCC you can go forward to GCC and so on.