News for hackers. Stuff that matters.
Re:CC500: a tiny self-hosting C compiler by progman on Saturday November 08, 2014 @03:29AM (#8576353)
Nice hack! The next step would probably be a CC which compiles to a minimal virtual CPU instruction set so that we just need some Assembler macros to port it to a native platform (x86, ARM, etc.), plus a library of formats (ELF etc.) to create applications for those platforms.
Re:CC500: a tiny self-hosting C compiler by beagle3 on Saturday November 08, 2014 @07:11AM (#8576630)
This was here just 3 days ago: https://news.ycombinator.com/item?id=8558822 ; Now, YOU just need to write those assumbler macros. But why? Are you in some shortage of working compilers?
Re:CC500: a tiny self-hosting C compiler by progman on Saturday November 08, 2014 @07:55AM (#8576725)
> Are you in some shortage of working compilers?

I am just interested in a small maintainable C compiler which can easily be adopted to bootstrap a new platform or cpu (on FPGA). I consider such a tiny C compiler just a convenient assembler to implement basic things on new platforms.

I know GCC and Clang/LLVM but those tool chains are really big, and I guess it requires a lot of work to support a new platform and to polish all things so that everything works properly.

A portable tiny GCC/LLVM replacement for small embedded systems would be really nice. GCC and Clang are great for powerful systems but I consider them overkill for small systems.

Re:CC500: a tiny self-hosting C compiler by qznc on Saturday November 08, 2014 @08:10AM (#8576758)
Do you know the "portable c compiler" PCC?

http://pcc.ludd.ltu.se/

Re:CC500: a tiny self-hosting C compiler by progman on Saturday November 08, 2014 @08:16AM (#8576770)
Thanks! I will study it.
Re:CC500: a tiny self-hosting C compiler by beagle3 on Saturday November 08, 2014 @02:22PM (#8577866)
Fabrice Bellard's "tiny cc"[0] is a great sweet spot between "not even a portable assembler" like CC500 and C4, and GCC/LLVM:

It is a full-blown C compiler with enough extensions to compile the Linux kernel (and boot to it directly - look at the "tccboot" project). But it's also small enough and simple enough to retarget in a few days work (make that a few month if you want optimizations ... but you don't seem to).

[0] http://bellard.org/tinycc

Re:CC500: a tiny self-hosting C compiler by MatzeBraun on Saturday November 08, 2014 @11:31AM (#8577314)
Re:CC500: a tiny self-hosting C compiler by vog on Saturday November 08, 2014 @05:19AM (#8576492)
I believe this is how modern compilers work anyway. GCC as well as clang (via llvm) have multiple frontends (one for each programming language) and multiple backends (one for each target platform.)