News for hackers. Stuff that matters.
Re:Ask HN: If Unix is written in C, how did they run C befor... by AnimalMuppet on Tuesday April 04, 2023 @12:19PM (#35442038)
The start of C and the start of Unix are approximately at the same time. In that time, there was a stepwise process. The first Unix (IIRC, someone can correct me) was written in assembly. Also written at that time was a simple compiled language. That compiled language was used to write a more complicated compiler. There was another such cycle (I think) before there was a C compiler - and even then, it wasn't the full C, but a subset. Unix was then re-written in C.
Re:Ask HN: If Unix is written in C, how did they run C befor... by whitten on Tuesday April 04, 2023 @12:46PM (#35442467)
I think it was BCPL then B then C.

That is why there was a nerd joke that the follower language to C should be P, not C++

Re:Ask HN: If Unix is written in C, how did they run C befor... by pjmlp on Tuesday April 04, 2023 @01:16PM (#35442901)
BCPL is actually the abbreviation of Bootstrapping CPL.

Originally BCPL wasn't going to be used for anything beyond bootstraping the CPL compiler, eventually it took a life of its own.

https://en.m.wikipedia.org/wiki/CPL_(programming_language)

There is some irony that for UNIX workloads we are stuck with the evolution of a language whose main purpose was only to bootstrap a compiler and be done with it.

Re:Ask HN: If Unix is written in C, how did they run C befor... by pizlonator on Tuesday April 04, 2023 @01:14PM (#35442874)
First Unix was written in asm. Then Ken came up with B to write some userland stuff more easily. B was not portable. B was a BCPL-like, but smaller and simpler.

Then Dennis came up with C. C was just portable B (it added types for the purpose of getting around the fact that word sizes differed between archs). And then the B code was recompiled with C and modified as needed. Though C is back-compatible to B somewhat (hence why C has the thing where no type implies int).