- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the types of the translator in compiler design?
A translator is a programming language processor that modifies a computer program from one language to another. It takes a program written in the source program and modifies it into a machine program. It can find and detect the error during translation.
There are various types of a translator which are as follows −
Compiler − A compiler is a program that translates a high-level language (for example, C, C++, and Java) into a low-level language (object program or machine program). The compiler converts high-level language into the low-level language using various phases. A character stream inputted by the customer goes through multiple stages of compilation which at last will provide target language.
Pre-Processor − Pre-Processor is a program that processes the source code before it passes through the compiler. It can perform under the control of what is referred to as pre-processor command lines or directives.
Assembler − An assembler is a translator which translates an assembly language program into an equivalent machine language program of the computer. Assembler provides a friendlier representation than a computer 0’s and 1’s that simplifies writing and reading programs.
An assembler reads a single assembly language source document and creates an object document including machine instructions and bookkeeping data that supports to merge of various object files into a program.
Interpreter − An interpreter is a program that executes the programming code directly rather than only translating it into another format. It translates and executes programming language statements one by one.
Macros − Many assembly languages support a “macro” facility whereby a macro statement will translate into a sequence of assembly language statements and possibly other macro statements before being translated into machine code. Therefore, a macro facility is a text replacement efficiency.
Linker − Linker is a computer program that connects and combines multiple object files to create an executable file. All these files might have been compiled by a separate assembler. The function of a linker is to inspect and find referenced module/routines in a program and to decide the memory location where these codes will be loaded creating the program instruction have an absolute reference.
Loader − The loader is an element of the operating framework and is liable for loading executable files into memory and implement them. It can compute the size of a program (instructions and data) and generate memory space for it. It can initialize several registers to start execution.
It creates a new address space for the program. This address space is huge to influence the text and data segments, along with a stack segment. It can repeat instructions and data from the executable file into the new address space.