Definition Of Compiler Design

A compiler translates a program in a source language to a program in a target language. The most well-known form of a compiler is one that translates a high-level language like C into the native assembly language of a machine so that it can be executed. And of course, there are compilers for other languages like C++, Java, C#, and Rust, and many others.

The same techniques used in a traditional compiler are also used in any kind of program that processes a language. For example, a type setting program like TEX translates a manuscript into a Postscript document.                                                         

[Also Read:Information About The Compiler Toolchain ]

A graph-layout program like Dot consumes a list of nodes and edges and arranges them on a screen. A web browser translates an HTML document into an interactive graphical display. 

To write programs like these, you need to understand and use the same techniques as in traditional compilers.Compilers exist not only to translate programs but also to improve them.

A compiler assists a programmer by finding errors in a program at compile time, so that the user does not have to encounter them at runtime.  

[Must Read:Details About Stages Compiler ]

Usually,a more strict language results in more compile-time errors. This makes the programmer’s job harder but makes it more likely that the program is correct. For example, the Ada language is infamous among programmers as challenging to write without compile-time errors, but once working, is trusted to run safety-critical systems such as the Boeing 777 aircraft.

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 Rubyare typically executed by an interpreter that reads the source code directly.

Compilers and interpreters are closely related, and it is sometimes possible to exchange one for the other. For example, Java compilers translate java source code into Java bytecode, which is an abstract form of assembly language. Some implementations of the Java Virtual Machine work as interpreters that execute one instruction at a time.

 Others work by translating the bytecode into local machine code and then running the machinecode directly. This is known as just-in-time compiling or JIT.

Post a Comment

Previous Post Next Post