Skip to content
AgileLogics

Programming glossary

Compiler

A program that translates source code into a separate, runnable program ahead of time, before it's executed.

Translating before running

Processors don't understand Java or C directly. They execute machine instructions, long sequences of very simple operations. A compiler bridges that gap. It reads your whole source file, checks it for errors, and produces an output file that can be run later, as many times as you like, without the original source code present. Think of translating a book: the translator works through the entire text once, and readers afterwards only need the translated copy.

Compiling also catches many mistakes early. A misspelled variable name or a type mismatch is often reported before the program ever starts.

Compiling a C program

With the GCC compiler installed, turning a C file into an executable looks like this:

gcc hello.c -o hello   # compile source into an executable
./hello                # run the result

The second command doesn't involve the compiler at all. The hello file is machine code your operating system can launch on its own.

Not every compiler targets machine code. javac turns Java into bytecode, which the Java Virtual Machine then runs. The TypeScript compiler outputs JavaScript.

Compiler vs interpreter

An interpreter executes code without first producing a standalone program. That sounds like a clean split, but it describes tools, not languages. CPython, the standard Python implementation, quietly compiles your code to bytecode and then interprets that bytecode. Modern JavaScript engines begin by interpreting and then compile frequently used code to machine code while the program runs, a technique called just-in-time (JIT) compilation. The JVM does the same with Java bytecode.

So "is Python compiled?" has no single answer. It depends on which implementation runs it.

Mistakes a compiler reports are called compile-time errors. Ones that only show up once the program is executing are known as runtime errors.

Learn more

Last updated