CS core subjects

Stage 1 · Lesson 7 of 7

Compilers, interpreters and bytecode

How a computer runs a program

Source code has to be turned into something the machine can run. A translates the whole program ahead of time into , the 's own instructions. C, C++, Rust and Go work this way.

An interpreter reads your code and runs it as it goes. Early Python and JavaScript worked like that. Many modern languages mix both.

Java and C# compile to bytecode, a simpler in-between code, which a virtual machine then runs. That virtual machine often has a just-in-time (JIT) compiler, which turns frequently used "hot" code into machine code while the program runs. This explains why some errors appear when you compile and others only when a line actually runs.

It also explains why a Java program needs a JVM, the Java virtual machine, installed. The theory stage returns to how compilers work inside.

Common trapcalling a language "compiled" or "interpreted" when that is a property of an implementation.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Keep handy

  • A topic map of the whole CS curriculum to check your coverage against, stage by stage

  • Short explanations from researchers when one idea, such as floating point, will not click

Also worth your time

Mark this stage as not done?