Q:

What are the functions of a compiler?

A:

Quick Answer

Compilers are an essential part of a computer programmer's toolkit. A compiler turns a plain text file containing code into a program that can be run.

Continue Reading
What are the functions of a compiler?
Credit: Gary Conner Photolibrary Getty Images

Full Answer

A common misconception is that computers understand code. This is not true. Computers only understand machine code, that is, code that is assembled for the architecture of the computer's processor. Some programs come in both 32-bit and 64-bit versions, and those using a 32-bit operating system cannot run 64-bit programs. Compilers turn the code that the programmer writes into machine code.

Not every language needs to be compiled, however. Some languages are known as interpreted languages; these are languages that are compiled at run time. Interpreted languages still need to be compiled into machine code, but this occurs as the program is being run. Once code from a compiled language is turned into a compiled program, it is not necessary for the end user of that program to have the compiler on his machine. However, the user of a program written in an interpreted language is required to have the interpreter on his machine. Some examples of compiled languages are C, C++, C# and Objective-C, while some examples of interpreted languages are Python, Ruby, PHP and JavaScript.

Learn more about Computer Programming

Related Questions

Explore