awesome-everything RU
↑ Back to the climb

Base CS from zero

From machine code to a language: trace a program down the ladder

Crux Hands-on project — take one tiny program, run it through the assembly, compiled, interpreted, and JIT paths, and document the layers, the one-to-one vs many-to-one mapping, and the full source-to-execution pipeline with evidence.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 210 min

Reading about the ladder from machine code to a language is not the same as walking one program down every rung yourself. Take a single tiny program, run it through assembly, a compiler, an interpreter, and a JIT, and watch with your own eyes how the same intent becomes different things at different layers.

Goal

Turn the unit’s mental model into a concrete, evidence-backed experiment: take one small program, observe the one-to-one and many-to-one mappings, compare compilation against interpretation, see the runtime at work, and trace the full source-to-execution pipeline end to end.

Project
0 of 7
Objective

Take one tiny program — compute and print the result of an arithmetic expression such as (a + b) * c — and trace it down every rung of the ladder, documenting with real tool output how the same intent becomes assembly, native machine code, interpreted execution, and JIT-compiled code.

Requirements
Acceptance criteria
  • A side-by-side table of the three paths with columns: artifact produced, when translation happens, and portability — filled from what you actually observed, not from memory.
  • A short annotated assembly listing where at least three lines are paired with the single machine instruction each becomes, plus the instruction count for the one chosen high-level statement.
  • A named list of at least three runtime services used and which runtime (libc, CPython, V8/Node) provides each.
  • A one-paragraph walkthrough of the six pipeline stages for the C program, naming the real tool or OS component at each stage (compiler, linker, OS loader, C runtime startup, the CPU).
Senior stretch
  • Add a Java or C# version that compiles to bytecode; inspect the bytecode (javap -c for Java) and explain how it differs from both native machine code and source text.
  • Time a tight CPU-bound loop in all versions and explain the ordering you observe — compiled fastest, interpreted slowest, JIT improving after warm-up — connecting each number to the translation strategy.
  • Cross-compile the C program for a second CPU architecture (e.g. ARM) and confirm the resulting binary will not run on the original CPU, demonstrating that the binary is CPU-specific while the source is portable.
  • Use a tool such as ldd (Linux) or otool -L (macOS) to list the shared libraries your C binary links against at run time, and connect that output back to the linking and loading stages.
Recap

This is the experiment that turns the ladder from a diagram into something you have touched: one program, four paths, one set of observations. You saw assembly map one-to-one to machine code, a single high-level statement expand to many instructions, a compiler produce a binary ahead of time while an interpreter produced none and a JIT produced native code at run time, the runtime quietly doing memory, library, and call-stack work for you, and the six-stage pipeline carrying source text all the way to the CPU’s fetch-decode-execute loop.

Continue the climb ↑What a value is
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.