TextbookFacilitator Handbook
Class10
Topic NameLanguage Processors – Assemblers, Compilers, and Interpreters
CategoryPython Programming Class 10
SubjectArtificial Intelligence Class 10 CBSE

In Basic Concepts of Python Programming, We Discussed Machine Language, Assembly Language, and High-level Languages and we also discussed that a machine can understand only Object Code or Machine Language.

Types of Language Processors

In the earlier days, programming was not as easy as it is now, at that time the codes were written in Binary format.

So to convert a high-level language and an Assembly language to machine language we use Converters or Translators such as Assemblers, Compilers, and Interpreters these converters of translates are the Language Processors.

The High-Level Code is called the Source Code and the basic machine language translated by the language processor is called Object Code, which the processor can “digest” or “understand”.

Language Processors can be divided into 3 Kinds:

Compilers

ExamplesC, C++, Java
First Commercial CompilerFORTRAN
Term Coined byGrace Brewster Murray Hopper
Released On1952
DevelopersJohn Warner Backus at IBM
TypeLanguage Processor

What are Compilers ?

Compiler is a Computer program (Set of Instructions) that is responsible for changing programmed code (Source Code) into a more basic machine language code (Object Code) which is easy to read and understand by the computer itself.

The compiler allows the computer to run and understand the program written at a high level by reading the complete source code at one time as a whole and then converting it into machine language or the Binary Code for the machine to understand and process it. Example: C, C++, C#, Java.

How do Compilers work?

hide
  1. Compiler goes through the whole Source Code.
  2. Analyses the Errors in the code.
  3. If errors are present, it specifies the errors at the end of compilation with line numbers.
  4. If no errors are detected, the source code is translated to the object code successfully.

Compilers go through the whole code at once and then compile the whole source code, unlike Interpreter which goes line by line.

Interpreters

Details of an Interpreter

ExamplesCPython, YARV, HotSpot, OpenJ9, JariKo
Examples of Languages using InterpretersPython, Perl, JavaScript, Ruby, Matlab
First Commercial CompilerLisp interpreter
Released On1958 
DevelopersJohn McCarthy’s student Steve Russell
TypeLanguage Processor

What is Interpreter ?

An Interpreter allows the computer to run and understand a program written in High-Level Language by reading the source code statement by statement. Unlike the compiler, the interpreter executes a single statement Immediately before moving on to the next line and stops the execution if any error is found in the statement.

The interpreter moves on to the next line for execution only after the removal of the error. An Interpreter directly executes the source code or the instructions written in a scripting language without a prior conversion of the source code into an Object or Machine code, it is converted directly into an executable code and returns the output.

How do Interpreters work?

hide
  1. Interpreter goes through the Source Code statement by statement.
  2. Analyses the Errors in the code Statement.
  3. If errors are present, it specifies the errors immediately before moving on to the next line and stops the execution.
  4. If no errors are detected, the source code is Executed.
  5. Instead of Being translated into Object Code, it directly converts into an Executable Code and returns the output.

Assemblers

Details of an Assembler

ExamplesGAS, GNU, etc
Examples of Assembly LanguagesMIPS, INTEL64/AMD64, ARM64, THUMPs, 6502
First AssemblerEDSAC’s Initial Orders
Released OnLate 1948
DevelopersDavid Wheeler
TypeLanguage Processor

What are Assemblers ?

Assemblers are used to convert or translate the program which is written in assembly language into machine code or object code. The input of an assembler is the source program that contains the assembly language instructions. This Source code is then translated into the Object or Machine Code which is understandable by the computer.

Assembly language was Introduced as a first step to improve programming structure and make machine language more understandable by humans.

Assembly language can be translated or rather converted into Machine level language using Assemblers.

Assembly language can be translated or rather converted into Machine level language using Assemblers. So assemblers act as a translator between assembly language and machine-level language.

Code written in assembly language is some sort of mnemonics(instructions) like ADD, MUL, MUX, SUB, DIV, MOV and so on. and the assembler is basically able to convert these mnemonics in Binary code. Here, these mnemonics also depend upon the architecture of the machine.