A compiler translates the code written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target code efficient and optimized in terms of time and space.
A compiler is distinct from an interpreter, which reads in a program and then executes it directly, without emitting a translation. This is also sometimes known as a virtual machine. Languages like Python and Ruby are typically executed by an interpreter that reads the source code directly.
Compilers and interpreters are closely related, and it is sometimes pos- sible to exchange one for the other. For example, Java compilers translate Java source code into Java bytecode, which is an abstract form of assem- bly language. Some implementations of the Java Virtual Machine work as interpreters that execute one instruction at a time. Others work by trans- lating the bytecode into local machine code, and then running the machine code directly. This is known as just in time compiling or JIT.
You will be a better programmer. A great craftsman must understand his or her tools, and a programmer is no different. By understanding more deeply how a compiler translates your program into machine language, you will become more skilled at writing effective code and debugging it when things go wrong.
You can create tools for debugging and translating. If you can write a parser for a given language, then you can write all manner of supporting tools that help you (and others) debug your own programs. An integrated de- velopment environment like Eclipse incorporates parsers for languages like Java, so that it can highlight syntax, find errors without compiling, and connect code to documentation as you write.
This tutorial is designed for students interested in learning the basic principles of compilers.Enthusiastic readers who would like to know more about compilers and those who wish to design a compiler themselves may start from here.
This tutorial requires no prior knowledge of compiler design but requires basic understanding of at least one programming language such as C, Java etc.It would be an additional advantage if you have had prior exposure to Assembly Programming.