Check out the architecture of TempleOS.
What, like C as a shell script? Gott in Himmel!
Re:OS X app in plain C
by Kristine1975 on Friday May 06, 2016 @02:11AM
(#11642037)
How about an interactive C++ interpreter: https://root.cern.ch/cling
Also it's Gott im Himmel ;-) (unless it's a reference I didn't get)
The design of C is predicated on an approach to portability that involves shipping source code, not binaries, around, with the destination machine having a compiler for its own architecture. (Given this, it's kind of shocking that things like Docker work at all. Goes to show how large a server-side monopoly those Intel ISAs currently hold.)
---
But wouldn't it be interesting if the "C compiler" were made into a low-level part of the operating system—basically taking the form of a JIT with a persistent cache—and then an executable format were specified, which really was just an archive of C source that was JIT-compiled by the OS when you first execv(3)ed it? Then you would have portable C binaries, because you'd be using the "correct" C ABI: C source-code.
Well, if you tack on a bit of pre-chewing to annotate the C source a bit (and maybe do some arch-neutral optimizations), and you have Apple's current LLVM-IR-based "Bitcode" approach to binaries.