Tuesday, March 5, 2013

Lesson 3.6

3.6 HIGH LEVEL LANGUAGES
You know that assembly language and machine level language require deep knowledge of computer hardware where as in higher language you have to know only the instructions in English words and logic of the problem irrespective of the type of computer you are using.

Higher level languages are simple languages that use English and mathematical symbols like +, -, %, / etc. for its program construction.

You should know that any higher level language has to be converted to machine language for the computer to understand.

Higher level languages are problem-oriented languages because the instructions are suitable for solving a particular problem. For example COBOL (Common Business Oriented Language) is mostly suitable for business oriented language where there is very little processing and huge output. There are mathematical oriented languages like FORTRAN (Formula Translation) and BASIC (Beginners All-purpose Symbolic Instruction Code) where very large processing is required.

Thus a problem oriented language designed in such a way that its instruction may be written more like the language of the problem. For example, businessmen use business term and scientists use scientific terms in their respective languages.


Advantages of High Level Languages
Higher level languages have a major advantage over machine and assembly languages that higher level languages are easy to learn and use. It is because that they are similar to the languages used by us in our day to day life.

3.6.1 Compiler 
It is a program translator that translates the instruction of a higher level language to machine language. It is called compiler because it compiles machine language instructions for every program instructions of higher level language. Thus compiler is a program translator like assembler but more sophisticated. It scans the entire program first and then translates it into machine code.

The programs written by the programmer in higher level language is called source program. After this program is converted to machine languages by the compiler it is called object program.


Higher Level Language                                                                  
----------------------------------      ® (Compile)    ®   Program  Machine Language                  Program


Fig. 3.2

A compiler can translate only those source programs, which have been written, in that language for which the compiler is meant for.   For example FORTRAN compiler will not compile source code written in COBOL language.

Object program generated by compiler is machine dependent. It means programs compiled for one type of machine will not run in another type. Therefore every type of machine must have its personal compiler for a particular language. Machine independence is achieved by using one higher level language in different machines.

3.6.2 Interpreter
An interpreter is another type of program translator used for translating higher level language into machine language. It takes one statement of higher level languages, translate it into machine language and immediately execute it. Translation and execution are carried out for each statement. It differs from compiler, which translate the entire source program into machine code and does involve in its execution.
.
The advantage of interpreter compared to compiler is its fast response to changes in source program. It eliminates the need for a separate compilation after changes to each program. Interpreters are easy to write and do not require large memory in computer. The disadvantage of interpreter is that it is time consuming method because each time a statement in a program is executed then it is first translated. Thus compiled machine language program runs much faster than an interpreted program.

       IN-TEXT QUESTIONS 3
1.   What is the difference between interpreter and compiler?
2.   Give some examples of high level language.
3.   Write True or False
   (a) High level languages are problem-oriented language.
 (b) Object program generated by compiler is machine independent.
 (c) The disadvantage of interpreter is that it is time consuming.

No comments:

Post a Comment