0% found this document useful (0 votes)
218 views

What Is A Language Processor

A language processor, or translator, is a computer program that translates source code from one programming language to another. There are three main types of language processors: assemblers, compilers, and interpreters. Assemblers translate assembly language into machine code. Compilers read entire source codes and translate them into machine code object files. Interpreters read and translate source code line by line before executing each line.

Uploaded by

Taimoor Gill
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
218 views

What Is A Language Processor

A language processor, or translator, is a computer program that translates source code from one programming language to another. There are three main types of language processors: assemblers, compilers, and interpreters. Assemblers translate assembly language into machine code. Compilers read entire source codes and translate them into machine code object files. Interpreters read and translate source code line by line before executing each line.

Uploaded by

Taimoor Gill
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

What Is a Language Processor?

A language processor, or translator, is a computer program that


translates source code from one programming language to another.
They also identify errors during translation.
Computer programs are usually written in high-level programming languages
(like C++, Python, and Java). Further, to make them understandable by the
computer, a language processor needs to translate the source code into
machine code (also known as object code, which is made up of ones and
zeroes).
There are three types of language processors: assembler, compiler, and
interpreter.

Assembler
The assembler translates a program written in assembly language into
machine code.
Assembly language is a low-level, machine-dependent symbolic code that
consists of instructions (like ADD, SUB, MUX, MOV, etc.):

Compiler
A compiler reads an entire source code and then translates it into machine
code. Further, the machine code, aka the object code, is stored in an object
file.
If the compiler encounters any errors during the compilation process, it
continues to read the source code to the end and then shows the errors and
their line numbers to the user.
Compiled programming languages are high-level and machine-independent.
Moreover, examples of compiled programming languages are C, C++, C#,
Java, Rust, and Go:

Interpreter
An interpreter receives the source code and then reads it line by line,
translating each line of code to machine code and executing it before moving
on to the next line.
If the interpreter encounters any errors during its process, it stops the process
and shows an error message to the user.
Interpreted programming languages are also high-level and machine-
independent. Python, Javascript, PHP, and Ruby are examples of interpreted
programming languages:
Interpreted programming languages are also high-level and machine-
independent. Python, Javascript, PHP, and Ruby are examples of interpreted
programming languages:
Comparison Between Interpreter and
Compiler
Compilers and interpreters both have their pros and cons:

Debugging
Debugging is easier with an interpreter since they stop right after encountering
an error message, whereas a compiler shows error messages after reading
the entire program.

Object File
A compiler generates a file containing machine code after translating the
source code. This file is known as an object file.
An interpreter doesn’t create an object file.

Execution Time
The execution time of a program written in an interpreted language is slower
since an interpreter needs to translate and execute each line of the source
code. However, since a compiler generates an object file, the execution time
is faster.

Needs Source Code


A compiler generates an object file, so we don’t need the source code to
execute the program later. In contrast, an interpreter requires source code to
execute the program.

Memory Usage
A compiler needs to generate object codes, so it requires more memory than
an interpreter.

You might also like