Lesson 1

Programs and compilation

What a program is, what a compiler does, and how your source code becomes an executable binary.

Level
Intro
Duration
12 min
Updated

What a program is

A program is a sequence of instructions a machine can execute step by step: read data, run calculations, show a result. You don’t write those instructions in the language the processor understands directly: you write source code, readable text in a language like Rust, Python, or JavaScript, and something turns it into instructions the machine actually understands.

This lesson doesn’t assume you already know how to program. If you’re coming from another language, it works as a vocabulary bridge before you start the main Rust track.

Pipeline state

  • SOURCE CODE · program.rsplain text, nothing has run
  • COMPILADOR · rustcwaiting
  • BINARIOdoesn't exist yet
01 / 04JUST TEXT · NOTHING RUN

Compiled versus interpreted

Rust isn’t the only possible approach. There are two common ways to go from source code to a running program:

Strategy What happens Examples
Ahead-of-time compilation The code is transformed into an executable before it is started. Rust, C, C++, Go
Interpreter or runtime The program runs through other software, which may also generate bytecode or compile parts during execution with a JIT. Python, JavaScript, Ruby

What’s next

In practice you’ll rarely invoke rustc directly. cargo, the tool you’ll install in Module 0, handles compiling, managing dependencies, and running the binary with a single command.

Summary

  • A program is a sequence of instructions; source code is the text you write to describe them.
  • Rust is a compiled language: rustc translates the full source code into a binary before running it.
  • An interpreter or runtime participates during execution and may use bytecode or JIT compilation, depending on its implementation.
  • The compiler detects many syntax and type errors before the program runs, although errors can still happen during execution.
  • In a conventional Rust executable, fn main is the entry point; cargo (Module 0) automates compiling and running it.

Sources