Compiler: A tool that converts the code you write into a form the computer can run, and reports certain mistakes, such as syntax and type errors, before the program runs.
Example
You build a Java project and the compiler stops with "';' expected" on line 42. You add the missing semicolon, build again, and it succeeds.
How Compiling Works
You write source code, such as a .java or .cs file. The compiler checks it and turns it into something lower-level: machine code for C and C++, or bytecode for Java and C#, which a virtual machine then runs. If the compiler finds errors, it doesn't produce output until you fix them.
Compile-Time vs Runtime Errors
| Compile-time error | Runtime error | |
|---|---|---|
| When | While building the code | While the program is running |
| Examples | Missing semicolon, wrong type, unknown variable | Null value, file not found, division by zero |
| Found by | The compiler | Tests, logs, or users. See exception. |
Compiler vs Interpreter
A compiler translates the whole program before it runs. An interpreter runs code line by line. Java and C# are compiled (to bytecode); Python and JavaScript are usually interpreted, which is why some of their mistakes only show up at runtime.
Interview tip: you rarely need compiler internals for an internship, but you should know this difference and be able to read a compiler error calmly.
Related terms
- Runtime: the stage after compiling, when the program actually runs.
- Exception: an error that happens at runtime.
- IDE: shows compiler errors as you type.
- Debugging: finding problems the compiler can't catch.
Previous term: Communication Skills | Next term: Confluence
Related guides
- Technical Interview Questions for Freshers
- Java Interview Questions Test
- .NET Interview Questions Test
Frequently asked questions
What is a compiler in simple words?
A compiler is a tool that translates your source code into a form the computer can run, and reports errors such as syntax mistakes before the program runs.
What is the difference between a compiler and an interpreter?
A compiler translates the whole program before running it. An interpreter runs code line by line as it reads it.
Is Java compiled or interpreted?
Java is compiled to bytecode, which the Java Virtual Machine then runs, using a just-in-time compiler for speed.
What is a compile-time error?
An error found while building the code, such as a missing semicolon or a wrong type, which stops the program from being produced.
Explore more internship terms
The IT Internship Glossary explains 199 terms you will hear before and during your internship, with simple definitions and real examples.
Browse all 199 terms