Languages Fundamentals

      Comments Off on Languages Fundamentals

Languages Fundamentals

Languages Fundamentals

Unit – 2      Languages Fundamentals

  • Generalization of Computer Language
  • High level & Low level languages and Assembly language : Concepts, Advantages, Disadvantages
  • Translator : Interpreter, Compiler, Assembler
  • Introduction to Editors : Definition , Examples



  • Generalization of Computer Language

To write a computer program, a standard programming language is used.

A programming language is composed of a set of instructions in a language understandable to the programmer and recognizable by a computer.

Programming languages can be classified as high-level, middle-level, and low-level.

High-level languages such as BASIC, COBOL (Common Business Oriented Programming Language), and FORTRAN (Formula Translation Language) are used to write application programs.

A middle-level language such as C is used for writing application and system programs.

A low-level language such as the assembly language is mostly used to write system programs.

Low-level programming languages were the first category of programming languages to evolve.

Gradually, high-level and middle-level programming languages were developed and put to use.

Figure 1 depicts the growth in computer languages since the 1940s.

The figure is meant to give some idea of the times that the different generations appeared, time scales, and relativity of computer languages to each other and the world of problem solving Languages Fundamentals.


Problem definition



1940            1950           1960          1970       1980          1990



Figure 1


A low-level computer programming language is one that is closer to the native language of the computer, which is l’s and O’s.

Machine language :

This is a sequence of instructions written in the form of binary numbers consisting of l’s and O’s to which the computer responds directly.

The machine language is also referred to as the machine code.

A machine language instruction generally has three parts as shown in Fig. 2.


                                                                           n – bits

<—- p – bits —-> <—- q- bits —-> <—- r – bits —->


Operation code            Mode                        Operand


n = p + q + r




The first part is the command or operation code that conveys to the computer   what function has to be performed by the instruction Languages Fundamentals.

All computers have operation codes for function such as adding, subtracting and moving.

The second part of the instruction either specifies that the operand contains data on which the operation has to be performed or it specifies that the operand contains a location, the contents of which have to be subjected to the operation.


Advantage of machine language The CPU directly understands machine instruc­tions, and hence no translation is required. Therefore, the computer directly starts execut­ing the machine language instructions, and it takes less execution time.

Disadvantages of machine language

  • Difficult to use It is difficult to understand and develop a program using machine language. For anybody checking such a program, it would be difficult to forecast the output when it is executed. Nevertheless, computer hardware recognizes only this type of instruction code.
  • Machine dependent The programmer has to remember machine characteristics while preparing a program. As the internal design of the computer is different across types, which in turn is determined by the actual design or construction of the ALU, CU, and size of the word length of the memory unit, the machine language also varies from one type of computer to another. Hence, it is important to note that after becoming proficient in the machine code of a particular computer, the programmer may be required to learn a new machine code and would have to write all the existing programs again in case the computer system is changed.
  • Error prone It is hard to understand and remember the various combinations of l’s and O’s representing data and instructions. This makes it difficult for a programmer to concentrate fully on the logic of the problem, thus frequently causing errors.
  • Difficult to debug and modify Checking machine instructions to locate errors are about as tedious as writing the instructions. Further, modifying such a program is highly problematic.


Assembly language

When symbols such as letters, digits, or special characters are employed for the operation, operand, and other parts of the instruction code, the representation is called an assembly language instruction Languages Fundamentals.

Such representations are known as mnemonic codes; they are used instead of binary codes. A program written with mnemonic codes forms an assembly language program.

Machine and assembly languages are referred to as low-level languages since the coding for a problem is at the individual instruction level.

Each computer has its own assembly language that is dependent upon the internal architecture of the processor.

An assembler is a translator that takes input in the form of the assembly language program and produces machine language code as its output. An instruction word consists of parts shown in Fig. 3 where,

  • The Opcode (Operation Code) part indicates the operation to be performed by the instruction and
  • The mode and operand parts convey the address of the data to be found or stored.
                                                                           n – bits

<—- p – bits —-> <—- q- bits —-> <—- r – bits —->



Operation code            Mode                        Operand


n = p + q + r




An assembly language program cannot be executed by a machine directly as it is not in a binary machine language form.

An assembler is needed to translate an assembly language program into the object code, which can then be executed by the machine.

The object code is the machine language code.

This is illustrated in Fig. 4.




Source Code                                                         Object Code




Advantage of assembly language Writing a program in assembly language is more convenient than writing one in machine language. Instead of binary sequence, as in machine language, a program in assembly language is written in the form of symbolic instructions. This gives the assembly language program improved readability.


Disadvantages of assembly language

  • Assembly language is specific to particular machine architecture, i.e., machine dependent. Assembly languages are designed for a specific make and model of a microprocessor. This means that assembly language programs written for one processor will not work on a different processor if it is architecturally different. That is why an assembly language program is not portable.
  • Programming is difficult and time consuming.
  • The programmer should know all about the logical structure of the computer.





High-level programming languages have instructions that are similar to human languages and have a set grammar that makes it easy for a programmer to write programs and identify and correct errors in them.

Advantages of high-level programming languages Languages Fundamentals

  • Readability Programs written in these languages are more readable than those written in assembly and machine languages.
  • Portability High-level programming languages can be run on different machines with little or no change. It is, therefore, possible to exchange software, leading to creation of program libraries.
  • Easy debugging Errors can be easily detected and removed.
  • Ease in the development of software Since the commands of these programming languages are closer to the English language, software can be developed with ease.

High-level languages are also called third generation languages (3GLs) Languages Fundamentals.


  • Compiler
  • Interpreter
  • Assembler



A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code).

The most common reason for wanting to transform source code is to create an executable program.

The name “compiler” is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).


An interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language. An interpreter may be a program that either

  1. executes the source code directly
  2. translates source code into some efficient intermediate representation (code) and immediately executes this
  3. explicitly executes stored precompiled code made by a compiler which is part of the interpreter system


An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations.



Difference between a compiler and an interpreter is as follows.







·         Scans the entire program before translating it into machine code


·         Converts the entire program to machine code and only when all the syntax errors are removed does execution take place


·         Slow in debugging, i.e., removal of mistakes from a program


·         Execution time is less



·         Translates and executes the program line by line

·         Each time the program is executed, every line is checked for syntax error and then converted to the equivalent machine code

·         Good for fast debugging



·         Execution time is more



  • Introduction to Editors :

An Editor is an program that we use to edit the Code of any program we write.

Most IDEs come with a built in editor and some will automatically highlight compile errors in the editor to simplify fixing them.



  • Notepad
  • Word Processor


General facilities provided by Editors are as follows:

  • text editing & manipulation
  • open , save, print file


Download Complete Tutorial in PDF Format.


Check more C Programing Tutorials and Codes