ELI5: How do C compilers work
Explained with a spaceship translator
A C compiler is like a spaceship translator that takes the human task list written by a Crewmate and translates it into tiny electronic beeps that the ship's computer can actually understand to fly the ship.
Imagine you are a yellow Crewmate on the Skeld. You write down a strategy note to survive the match: swipe card in Admin, fix wiring in Electrical, and watch out for the red Impostor venting. However, the spaceship's computer is ancient and only understands electrical pulses, like flashing lights of ones and zeroes. It cannot read your English handwriting at all!
To make your plan work, your note must go through four special airlocks:
- The Preprocessor (The Emergency Meeting Prep): Before anything else, a helper cleans up your note. If you wrote shortcuts like Call Red Sus, the helper replaces that phrase with Red was seen standing over a vent in Medbay. It also brings in outside rulebooks that tell the ship what words like swipe or vent mean.
- The Compiler (The Blueprint Maker): Next, an expert translator checks your handwriting. If you wrote an impossible task, like do visual shields in the Cafeteria, it sounds an alarm called a Syntax Error and ejects the note. If everything makes sense, it turns your note into a basic, step-by-step assembly guide for simple machines.
- The Assembler (The Translator): This machine takes that assembly guide and converts it directly into pure Machine Code. These are raw electrical signals, like clicking the buttons on the Reactor console.
- The Linker (The Task Gatherer): You are not the only Crewmate on the ship! Other crew members wrote instructions for the Oxygen tanks and the Navigation engines. The Linker glues your translated note together with all the other notes and ship libraries into one big, complete master plan called an Executable.
Once the master plan is built, you can finally press the big button. The spaceship runs the file, the doors lock, the tasks get completed, and you defeat the Impostors without any glitches!
Ask your own question
Follow-up questions
Test yourself
Three quick questions to see if it stuck. You can challenge a friend after.
Get this entry by email
We'll send it to your inbox, plus one good explanation a week if you like.