Skip to main content

Computer Languages


Article No: 6

As we know that without software computer box is useless. So to make software we require set of instructions known as programs. To write any program, a standard programming language is used.

A language is a means of communication.We use a natural language such as English to communicate our ideas and emotions to others. Similarly, a computer language is a means of communication used to communicate between people and the computer. With the help of a computer language, a programmer tells a computer what he/she wants it to do.

All natural languages (English, French, German, etc.) use a standard set of words and symbols (+, -, :, ;, <, >, etc.) for the purpose of communication. These words and symbols are understood by everyone using that language. We normally call the set of words allowed in a language, the vocabulary of that particular language. For example, the words we use in English form the vocabulary of an English language. Each word has a definite meaning and can be looked up in a dictionary. In a similar manner, all computer languages have a vocabulary of their own. Each word of the vocabulary has a definite unambiguous meaning, which can be looked up in the manual meant for that language. The main difference between a natural language and a computer language is that natural languages have a large vocabulary but most computer languages use a very limited or restricted vocabulary. This is mainly because a programming language by its very nature and purpose does not need to say too much. Each and every problem to be solved by a computer has to be broken down into discrete (simple and separate), logical steps which basically comprise of four fundamental operations – input and output operations, arithmetic operations, movement of information within the CPU and memory, and logical or comparison operations.

Each natural language has a systematic method of using symbols of that language which is defined by the grammar rules of the language. These rules tell us how to use the different words and symbols allowed in the language. Similarly, the words and symbols of a particular computer language must also be used as per set rules, which are known as the syntax rules of the language. In case of a natural language, people can use poor or incorrect vocabulary and grammar and still make themselves understood. However, in the case of a computer language, we must stick to the exact syntax rules of the language if we want to be understood correctly by the computer. As yet, no computer is capable of correcting and deducing meaning from incorrect instructions. Computer languages are smaller and simpler than natural languages but they have to be used with great precision. Unless a programmer follows exactly to the syntax rules of a programming language, even down to the punctuation mark, his/her instructions will not be understood by the computer.

Programming languages have improved over the years, just as computer hardware has improved. They have progressed from machine-oriented languages that use strings of binary 1s and 0s to problem-oriented languages that use common mathematical and/or English terms. However, all computer languages can be broadly classified into the following three categories as per shown in below diagram:


                                       

FIGURE 1.7 Programming Languages


Machine Language

It is a language made up of binary numbers (known as bits) consisting of 1’s and 0’s to which the computer can understand easily. The machine language is also known as machine codeand machine code is also known as native code. E.g. suppose there are three subjects’ marks to be added and store in result variable, than code in machine language will be as:

11000101 = 11110001 + 11101010 + 10100011


FIGURE 1.8 Source code directly into object code

A machine language instruction generally has two parts as shown in figure. The first part is the command or operation code that sends to the computer what function has to be performed by the instruction. All computers have operation codes for functions 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 where the operands are situated like RAM, registers . . .etc.




 
FIGURE 1.8 General format of machine language instruction




FIGURE 1.8 ADD Instruction format


Here, in figure (last), the first part contains operation code (+), second part contains operand (data) 20, and third part contains second operand 30. When this instruction will be executed, compiler will identify the operation to be done by operation code. With the help of operation code, compiler can also know that what the length of instruction is. Here in diagram, operation code is ADD which means that compiler must add two operands (20 and 30).




 
FIGURE 1.8 Instruction containing addresses of operands.

Here in this figure, instead of operands their memory addresses are stored. In second part of the instruction, 101 is the address of operand 20, and in third part of the instruction, 102 is the address of operand 30. When compiler will execute this instruction, it will find the operands through its addresses.

Advantages of Machine Language

·         No translation of program is required because CPU can understand directly.
·         It execute fast.
·         It occupies less memory than assembly and high level language.

Disadvantages of Machine Language

·         It is difficult to develop programs for programmers.
·         Finding errors in it is very difficult.
·         The programmer must know internal design of hardware to make any program.
·         All operation codes and memory addresses have to be remembered.
·         These languages are machine dependent, means program written for one computer cannot be used in other computer.


Assembly Language

When symbols such as letters, digits, or special characters are used for operation, then this language is known as assembly language.Symbols can also be referred as mnemonic codes because it has combination of maximum 3 or 4 characters, such as ADD for addition, SUB for subtraction, MUL for multiplication. Because of this feature it is also known as Symbolic Programming Language.To convert the code into machine language assembler is used.E.g. same example of adding three subject marks is shown in assembly language.

LOAD MARKS1
ADD MARKS2
ADD MARKS3
STORE RESULT






 
FIGURE 1.9 Source code converted into object code through Assembler



Advantages of Assembly Language

·         Writing a program in assembly language is easier than writing in machine language
·         It is easy to modify
·         It is easy to use and understand
·         Finding errors is easy than machine language

Disadvantages of Assembly Language

·         Like machine language it is also machine dependent
·         Developing programs is difficult and time consuming
·         The programmer must have knowledge about logical structure of the computer
·         Assembler required to translate the program


High-level Language

High level computer languages give formats close to English language and the purpose of developing high level languages is to allow people to write programs easily and in their own native language environment (English). High-level languages are basically symbolic languages that use English words and/or mathematical symbols rather than mnemonic codes. Each instruction in the high level language is translated into many machine language instructions. To convert the code into machine level language, compiler is used. E.g. adding marks of three subjects:

Result = Marks1 + Marks2 + Marks3


FIGURE 1.10 Source code converted into object code through Compiler


Advantages of High-level Language

·         Programs written in this language are more readable than those written in assembly and machine languages.
·         It is easier to learn
·         Requires less time to develop programs
·         Easier to maintain
·         It is independent of machine, means program written for one machine can be run on other machines
·         Error checking is easy

Disadvantages of High-level Language
·    A high-level language has to be translated into the machine language by a translator and thus a price in computer time is paid.
·    he object code generated by a translator might be inefficient compared to an equivalent assembly language program.




Compiled By: Chaudhary Amit V.

Comments

Popular posts from this blog

Characteristics of a Good Programming Language

Till now there are many high level languages which are very popular, and there are others, which could not become so popular in-spite of being very powerful. There might be many reasons for the success of a language, but one obvious reason is the characteristics of the language. Several characteristics believed to be important with respect to making a programming language good are briefly discussed below. Simplicity A good programming language must be simple and easy to learn and use. For example, BASIC is liked by many programmers only because of its simplicity. Thus, a good programming language should provide a programmer with a clear, simple and unified set of concepts which can be easily grasped. It is also easy to develop and implement a compiler or an interpreter for a programming language that is simple. However, the power needed for the language should not be sacrificed for simplicity. The overall simplicity of a programming language strongly affects the readability of the pr...

Angular 4 and Firebase Authentication: Email/Password

In our  previous  article we saw how to create authentication module using Google identity provider. Now we will see how to implement Email and Password authentication using Firebase. We will use Bootstrap form to create intuitive user interface for sign-up and login using Email and Password. Step 1: Create signUp component. ng generate component signUp Step 2: Create custom form in sign-up.component.html file. The result of above code: Step 3: Add two functions for creating the user and login using Email and Password in src/app/providers/AFAuth.ts file. Step 4: Call createUserWithEmailAndPassword function in service from sign-up.component.ts. Step 5: Update routing configuration in app.module.ts  to include signUp component. Step 6: Update Login form to have Bootstrap form. The result of the above code. Step 7: Enable Email/Password component in Firebas...

Angular 4 and Firebase Authentication: Setup

If you have come to this article, it means you are keen to learn new technology and that too Firebase. I love Firebase because it provides all basic but important features of any web application. Take for example, authentication, which is cumbersome and risky if not implemented with utmost care. And when we have the integration of Angular and Firebase, it becomes a lot easier for a developer to build such crucial modules in less time with minimal efforts. In this article we will create a simple Angular application using Firebase. I am going ahead with the understanding that you know the benefits of Firebase and have little knowledge about it. There are plenty of posts out on the web if you are behind. Step 1: Install Angular CLI (if not installed). npm install -g angular-cli Step 2: Create new Angular 4 project. By default now angular CLI will create Angular 4 project so you need not fret. ng new firebase-authentication Step 3: Check whether the ne...