Last updated 2022-11-05 03:50:45

What Is A Compiler?

Table of contents


The general definition goes something like this, A compiler is a program that translates a programming language [→] to another mostly low-level [→] one that the computer can understand.

To better understand this, you need to consider the fact that computer language designers create a language that contains enough syntax [→] and precise grammar to get the computer to do things. Now once they are done defining all these rules, they need to create a program that can understand this new language and translate it into instructions for the computer.

With a compiler that understands this new language other developers can now write instructions for the computer using the language, then use the compiler to translate it into something the computer can execute.

NB: There is also another type of program that is capable of this called the interpreter [→], the main difference being what they output.

Compilers take your instructions and build them into a program much like most of the apps you have on your computer or phone, whereas the interpreter just executes the instructions line by line hence it outputs no app-like programs you can double click to run. You will always have to have an interpreter to run the instructions.

Use cases and Examples

Many practical programming languages [→] out there have either a compiler or interpreter, sometimes both but the complexities of programming languages make it very rare.

Depending on the needs of some software, compilers are best suited for some and interpreters for others. For example, because compiled programs are usually a lot faster, they are more suitable for the development where speed is critical when the program is running.

Most of these can be installed like you will any program on your computer, and as long as you understand how to use it and know the syntax of the programming language it's built for, you can begin creating software others can use.

Examples of compiled languages include but not limited to C, C# [↗], Golang [↗] and Rust [↗]


Some programming languages have more than one compiler, this usually happens when a group of users or developers feel the original compiler might be lacking a key feature, or too slow when converting instructions to programs or that the programs themselves are slow.

Here is another article you might like 😊 "What Is A Configuration?"