Assembler, Compiler, and interpreter


A compiler is a language translator that converts high-level programs into machine-understandable machine codes. An interpreter is to convert high-level programs into machine codes. interpreters convert the source code to machine code line by line. Assembly language is in between the high-level languages and machine language.

Now, again A Compiler is a software which converts a program written in a high-level language (Source Language) to low-level language (Object/Target/Machine Language).

figure:compiler
figure: compiler

Compiler 2 types:

Cross Compiler that runs on a machine ‘C’ and produces code for another translates machine”M”. It is capable of creating code for a platform other than the one on which the compiler is running.

Source-to-source Compiler is a compiler that source code is written in one programming language(C) into the source code of another programming language (Java).

Language processing system using Compiler:


We know a computer is a logical assembly of Software and Hardware. The hardware knows a language that is hard for us to grasp, consequently, we tend to write programs in a high-level language that is much less complicated for us to comprehend and maintain in thoughts. Now, these programs go through a series of transformation so that they can readily be used machines. This is where language procedure systems come handy.

Blue Host Free
Blue Host Free

High-level Language: If a program contains #define or #include directives such as #include or #define it is called HLL. They are closer to humans but far from machines. These (#) tags are called preprocessor directives. They direct the pre-processor about what to do.

Pre-Processor: The pre-processor removes all the #include directives by including the files called file inclusion and all the #define directives using macro expansion. It performs file inclusion, augmentation, macro-processing, etc.

Assembly Language It’s neither in binary form nor high level. It is an intermediate state that is a combination of machine instructions and some other useful data needed for execution.

Assembler: For every platform (Hardware + Operation system) we will have an assembler. They are not universal since for each platform we have one. The output of assembler is called an object file. It translates assembly language to machine code.

Interpreter: An interpreter converts high-level language into low-level machine language, just like a compiler. But they are different in the way they read the input. The Compiler in one go reads the inputs, does the processing and executes the source code whereas the interpreter does the same line by line. Compiler scans the entire program and translates it as a whole into machine code whereas an interpreter translates the program one statement at a time. Interpreted programs are usually slower with respect to compiled ones.

Loader/Linker: It converts the reloadable code into absolute code and tries to run the program resulting in a running program or an error message (or sometimes both can happen). Linker loads a variety of object files into a single file to make it executable. Then loader loads it in memory and executes it.

Difference between Assembler, Compiler and interpreter :

Assembler               Compiler                 Interpreter
1. Assembly language is in between the high-level languages and machine language. 1. A compiler is a language translator that converts high-level programs into machine codes. 1. An interpreter is a software that translates a high-level language program into machine language
2. The assembler converts the assembly language program to machine language. 2. The compiler converts the whole program to machine code at a time. 2. The interpreter converts the high-level language program to machine language line by line.
3. Assembly language uses. 3.Used by c, c++ 3. Ruby, Perl, Python, PHP uses an interpreter

here is more important tropic
https://worldblogmedia.com/electrical-electronics-engineering/

Leave a Reply

Your email address will not be published. Required fields are marked *

Shares