What Is A Language Processor
What Is A Language Processor
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.
Memory Usage
A compiler needs to generate object codes, so it requires more memory than
an interpreter.