Sie sind auf Seite 1von 8

COMPILER VS INTERPRETER

FIT MCA 101

COMPILER VS INTERPRETER
Both convert one level of language to another level. A compiler converts the high level instructions into machine language while an interpreter converts the high level instruction into some intermediate form and after that, the instruction is executed.

COMPILER

A compiler is defined as a computer program that is used to convert high level instructions or language into a form that can be understood by the computer. Since computer can understand only in binary numbers so a compiler is used to fill the gap otherwise it would have been difficult for a human to find info in the 0 and 1 form. There are specific compliers for certain specific languages or tasks. Compliers can be multiple or multistage pass. The first pass can convert the high level language into a language that is closer to computer language. Then the further passes can convert it into final stage for the purpose of execution.

COMPILER

INTERPRETER

The programs created in high level languages can be executed by using two different ways. The first one is the use of compiler and the other method is to use an interpreter. High level instruction or language is converted into intermediate from by an interpreter. The advantage of using an interpreter is that the high level instruction does not goes through compilation stage which can be a time consuming method. So, by using an interpreter, the high level program is executed directly. That is the reason why some programmers use interpreters while making small sections as this saves time. Almost all high level programming languages have compilers and interpreters. But some languages like LISP and BASIC are designed in such a way that the programs made using them are executed by an interpreter.

ASSEMBLERS

. An assembler is a program which translates assembly language code into processor instructions Assembly, assembler, or asm for short, is the generic name given to all low-level languages. Now whats a low-level language? Well, whereas in high-level languages, each line of source code typically translates into more than one processor instruction, in an assembly language, each line directly corresponds to one single processor instruction. Assembly offers the programmer exact control: what you write is exactly what gets executed, instruction-by-instruction. Because different processors understand different sets of instructions, the assembler language you use must be particular to the processor platform you intend to run your program on the exact control provided by assembly allows for optimizations simply not possible in high-level languages

LINKERS

The source code of all but the smallest programs is written spread across multiple files, and in most languages, these files are treated as separate compilation units, i.e. they are compiled independently of each other.
When a compiler produces processor instructions, the resulting code is called object code, and the resulting files are called object files.

To make a complete program, multiple object files need to be linked together:


In a program, the code in one source file makes a reference to code in other files and/or is referenced by code in other files: a program is a web of source files which make external references to each other Still, each source file is compiled separately, meaning that, when processing one source file, the compiler has no knowledge of the files referenced by the source code when the compiler encounters an external reference in the source code, all it can do is leave a stub in the object code allowing the connection to be patched later. Patching together the external reference stubs of one object file to another is precisely the job of a linker linker that takes many object files and produces from them an executable file (e.g. an .exe file on Windows). n

Das könnte Ihnen auch gefallen