find and solve ||
Please wait.....

What is Programming Language

Introducing to Programming

A Computer is a calculating and device that is used to perform calculations and manipulations on various types of data, such as integers, strings, and float numbers. For example, it helps you to prepare the balance sheet of a business organization, generate sales reports, and create complex graphs showing profit and loss of a business over a given period. A computer performs all these tasks with the help of numbers of software, such as word processors, spreadsheets, and database applications. Software can defined as a set of one or more programs, which are organized sets of certain statements and instructions that direct a computer to perform a specific task. These programs are converted into executable files with the help of a compiler or an interpreter. These files are then used by a computer to execute the instructions written in the program. The languages in which these programs are written are known as programming languages. 
The chapter begins with a discussion on programming languages and their types. Then you learn how the source code of a program in converted into machine language code. Finally, you learn about the program development life cycle.
Let's begin by discussing about the programming languages.

Introducing a Programming Language

As already stated, a programming language is a language in which the source code of a program is written. To understand a programming languages, let's consider the simple task of adding two numbers. The task of adding two numbers can be divided into the following four steps.

1. Write down the first number.
2. Write down the second number
3. Add the numbers
4. Write the sum

These are very simple instructions by following which anyone can perform the task of adding two numbers. However, a computer cannot add two numbers by following these instructions. Then how would you communicate your instructions to a computer to perform this particular task? A  programming language is used by the programmers to write instructions that a computer can understand in order to perform the task. Each programming language has its own set of rules, known as syntax, which governs the structure of the statements in program.

Programming languages can be broadly divided into the following two categories:

⦁ High-level language
⦁ Low-level language

Let's discuss these two types of programming languages in detail, one by one.

High-level Language

A high-level language is a programming language that enables a programmer to create programs using simple human language, such as English statements. These languages are machine-independent and easily readable and understandable by the programmer. These languages make the process of developing a program easy and also increase the readability of the program that is, these languages are easier to read, write, understand, and maintain. A high-level language follows an easy-to-understand syntax. Due to its easy syntax, a high-level language is easy to learn and understand. However, a computer itself cannot understand programs written by using a high-level language. To make a computer understand the programs written in a high-level language, these programs need to be converted into machine level language (you learn more about the machine language and conversion of code from high-level language to machine language later in the chapter.) Examples of high-level language are BASIC, C, C++, and C#. Listing 1.1 shows a program for addition of two numbers, written in a high-level language (BASIC) :

Listing 1.1: Program to Add Two Numbers in BASIC

10 LET A = 2
20 LET B = 3
30 LET SUM = A + B
50 END
In Listing 1.1, 10, 20, 30, 40, and 50 line numbers and each line has one command.

Low-Level Language

In contract to high-level language, a low-level language is a machine-dependent language. The programs written in this language are specific to only those types of computers for which they are written. Therefore, this language cannot be easily converted to run on a different type of computer and is also difficult to learn because a programmer needs a detailed knowledge of the internal working of the computer while working with this language. Low-level language. Low-level language can be divided into the following two categories:

Assembly language
Machine language

Let's discuss these two types in detail, one by one.

Assembly Language

Earlier, when high-level languages were not invented, programmers used to write programs in the assembly language. Similar to a high-level language, a program written in the assembly language is also not understandable by a computer. To make it understandable to a computer, it needs to be translated into machine language code with the help of an assembler (you learn more about an assembler later in this chapter). A program written in the assembly language consists of a set of instructions called mnemonics.

Listing 1.2 shows a program for printing a string on the screen, written in the assembly language: 

 model small
message db "Hello world", "$"

main proc
mov ax, seg message
mov ds, ax
mov ah, 09

lea dx,message
int  21h

mov ax, 4c00h
int 21h
main endp

end main

Machine Language

The machine language is the only language that a computer can understand directly, A program written in the machine language is a sequence of  binary digits-1s and 0s. The machine language is very difficult to understand and learn even for an advanced programmer. Due to this reason, programmers generally avoid using machine language to write programs. Instead of writing programs in machine language, programmers generally write programs in a high-level language or an assembly language and those programs can be later converted into machine language code. The language used to write programs is termed as source language, such as C#, Visual Basic and the program code written in the source language is termed as source code.
The next section explains how the source code of a program is converted into machine language code.

Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.


Report Response