Define source code and object code. What is difference between them?

Source code: A program written in a high-level language is called source code. Source code is also called source program. Computer cannot understand the statements of high-level language. The source code cannot be executed by computer directly. It is converted into object code and then executed.

Object code

A program in machine language is called objet code. It is also called object program or machine code. Computer understands object code directly.

Difference between source code and objet code

Source code

Object code

  1. Source code is written in high-level or assembly language.
  1. Object code is written in machine language through compilers.
  1. Source code is easy to understand.
  1. Object code is difficult to understand.
  1. Source code is easy to modify.
  1. Object code is difficult to modify.
  1. Source code contains fewer statements than object code.
  1. Object code contains more statements than source code.

 

Describe language processors or translators and their use. Discuss different types of language processors.

Language translator

Language translator is a program that translates a program of high level language of computer understands only machine language. A program written in high-level or assembly language cannot be run on a computer directly. It must be converted into machine language before execution.

Types of translators

Different types of translators or language processors are:

  1. Compiler
  2. Interpreter
  3. Assembler

1. Compiler

A compiler is a program that converts the instruction of a high level language into machine language as a whole. A program written in high-level language is called source program. The compiler converts the source program into machine code. The machine code program is known as object program. The object program can executed many times.

working_of_compiler

Figure:working of compiler

The compiler checks each statement in the source program and generates machine instructions. Compiler also checks syntax errors in program. A source program containing an error cannot be compiled.

2. Interpreter

An interpreter is a program that converts one statement of a program into machine at one time. It executes this statement before translating the next statement of the source program. If there is an error in the statements, the interpreter stops working and displays an errors message.

The advantage of interpreters over compilers is that an error is found immediately. So the programmer can correct errors during program development. The disadvantage of interpreter is that it is not very efficient. The interpreter does not produce an object program. It must convert the program each time it is executed. Visual basic uses interpreter.

3. Assembler

An assembler is translating program that translates the instruction of a assembly language into machine language.