Why is compiler needed




















Some compilers generate machine language, some generate assembly language, some generate more portable code such as C code, some create abstract machine code. Some just generate data structures that are used by other parts of a program. That is the type of compiler that you will develop.

The first compilers were written in the s. Compiler developers had a poor understanding of what they were doing, and did everything in an ad-hoc way. The popular wisdom was that it took 30 person-years to write a compiler, even for a very simple programming language such as early versions of Fortran.

Considering the state of the art at the time, the compiler developers did a remarkably good job. Their code optimizers produced excellent machine code.

That was really important because if the compilers produced poor machine code, programmers would have been much slower to adopt Fortran. As we know that computers can easily understand machine language. There are different programs related to compiler that works before compilation such as editor, preprocessor, assembler, linker or loader, debugger and profiler.

Abadit Ali answered. To understand the concept of complier you must know about the program and machine codes. A program is a set of instructions which is developed by a programmer using any of the computer programming languages.

These languages are human readable languages. A machine code is a language which is readable only by a computer. A human is not able to understand the machine codes. So when the instructions are send to computer in human readable language a program is used to translate the human readable language into machine language.

That program is called compiler. The purpose of the compiler is to translate the programs written in human readable language to machine language which is understandable to computer machine. A compiler reads instruction in the programs and translates it, if there is any error it also identify it and warns about it to user.

The error could be typing mistake syntax error or a logical error. Compiler is language processor used to translate program written in high level language into the machine level language. A program written in high level programming language is called the source program.

The source program is stored on the disk in a file. The compiler translates the source program into machine codes and makes another program file is called the object file. The object file contains the translated program. Files, source and object are saved on the disk permanently. The object programs translated by compiler can executed a number of times without translating it again.

If there are any errors in the source program the compiler specifies the errors at the end of compilation. The errors must be removed before the compiler can successfully compile the source program. Computer understands only two words 0 and 1. Machine language or binary languages were used to write compilers. But it is very difficult to write complex code in form of 0 and 1. So we use high level programming languages are used to write compiler.

Compiler is also used to communicate with hardware. A machine language programs are made up of series of binary pattern. Machine language programs are executable so that they can be run directly. To make code portable, the source code is first converted to Object Code. It is an intermediary code similar to machine code that no processor will understand. At run time, the object code is converted to the machine code of the underlying platform. To exploit relative advantages of compilers are interpreters some programming languages like Java are both compiled and interpreted.

The Java code itself is compiled into Object Code. At run time, the JVM interprets the Object code into the machine code of the target computer. Skip to content. Compiled code runs faster while interpreted code runs slower. Compiler displays all errors after compilation, on the other hand, the Interpreter displays errors of each line one by one.

Compiler is based on translation linking-loading model, whereas Interpreter is based on Interpretation Method. Compiler takes an entire program whereas the Interpreter takes a single line of code.

Report a Bug. Previous Prev. Home Testing Expand child menu Expand. SAP Expand child menu Expand. Web Expand child menu Expand. Must Learn Expand child menu Expand. Big Data Expand child menu Expand.



0コメント

  • 1000 / 1000