Live data from Hacker News

SectorC: A C Compiler in 512 bytes

xorvoid.com

1–10 of 82 posts

Re: SectorC: A C Compiler in 512 bytes

#5
something 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.

Re: SectorC: A C Compiler in 512 bytes

#6
post #4
post #3

I'm wondering if you can build an actual "Linux from scratch" with this as the lowest level, without the need to use a host system at all.

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.

Re: SectorC: A C Compiler in 512 bytes

#9

something 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

#10
post #4

Earlier quoted context omitted.

Without structs? Good luck...

wonder how many extra bytes for structs?

In my experience, probably at least a 200-400 lines of C (another 512 bytes minimum? I don't know the conversion).

The problem is not just declaring structs but accessing them, referencing them, accessing/referencing fields and subfields, etc. That has to all be in the syntax. For such a minimal project you can ignore initialization.

I did all this while adding maybe 500 lines of C to GitHub.com/vitiral/fngi. Never tried for this level of minimalism though.

Post reply on HN