From what I remember from watching Terry's videos he also did something like this in TempleOS with his compiler HolyC. His shell is apperently just his compiler running in an interactive mode.
HolyC is "kind of" C from a compiler perspective so I think it counts.
Rather than using shebang notation for running C source files, which as noted leads to code which isn't legal input to a normal C compiler, there is a standard trick to please both the shell and the C compiler:
#if 0
/bin/env cpi "$0"
exit
#endif
And you don't need this cpi program depending on your tolerance for hacks:
I do something very similar to this, but just using cmake and basic bash scripts to launch the compilation and then run the executable all at once. And for the interpreter mode, a bash script can just automatically dump that into a main function, and then compile and run it all at once.
It's cool, but you can set something up like this just a few lines of bash code.
The page claims that CPI is an interpreter, but as this post says it is not. It just uses a regular compiler to build the input, then fiddled with the file descriptors to hook up the new executable's I/O to cpi's existing fds.
- cling: https://root.cern.ch/cling
- cint: http://www.hanno.jp/gotom/Cint.html
- Ch: https://www.softintegration.com/
If people know of other ones, I'd love to hear about them in the comments!