Introduction to programming languages

Introduction to programming languages


Modern computers are incredibly fast, and getting faster all the time. Yet with this speed comes some significant constraints. Computers only natively understand a very limited set of instructions, and must be told exactly what to do. A program (also commonly called an application or software) is a set of instructions that tells the computer what to do. The physical computer machinery that executes the instructions is the hardware.
Machine Language:
A computers CPU is incapable of speaking C++. The very limited set of instructions that a CPU natively understands is called machine code (or machine language or an instruction set). How these instructions are organized is beyond the scope of this introduction, but it is interesting to note two things. First, each instruction is composed of a number of binary digits, each of which can only be a 0 or a 1. These binary numbers are often called bits (short for binary digit). For example, the MIPS architecture instruction set always has instructions that are 32 bits long. Other architectures (such as the x86, which you are likely using) have instructions that can be a variable length.
Here is an example x86 machine language instruction: 10110000 01100001.
Second, each set of binary digits is translated by the CPU into an instruction that tells it to do a very specific job, such as compare these two numbers, or put this number in that memory location. Different types of CPUs will typically have different instruction sets, so instructions that would run on a Pentium 4 would not run on a Macintosh PowerPC based computer. Back when computers were first invented, programmers had to write programs directly in machine language, which was a very difficult and time consuming thing to do.
Assembly Language:
Because machine language is so hard to program with, assembly language was invented. In an assembly language, each instruction is identified by a short name (rather than a set of bits), and variables can be identified by names rather than numbers. This makes them much easier to read and write. However, the CPU cannot understand assembly language directly. Instead, it must be translated into machine language by using an assembler. Assembly languages tend to be very fast, and assembly is still used today when speed is critical. However, the reason assembly language is so fast is because assembly language is tailored to a particular CPU. Assembly programs written for one CPU will not run on another CPU. Furthermore, assembly languages still require a lot of instructions to do even simple tasks, and are not very human readable.
Here is the same instruction as above in assembly language: mov al, 061h
High-level Languages
To address these concerns, high-level programming languages were developed. C, C++, Pascal, Java, Javascript, and Perl, are all high level languages. High level languages allow the programmer to write programs without having to be as concerned about what kind of computer the program is being run on. Programs written in high level languages must be translated into a form that the CPU can understand before they can be executed. There are two primary ways this is done: compiling and interpreting.
A compiler is a program that reads code and produces a stand-alone executable program that the CPU can understand directly. Once your code has been turned into an executable, you do not need the compiler to run the program. Although it may intuitively seem like high-level languages would be significantly less efficient than assembly languages, modern compilers do an excellent job of converting high-level languages into fast executables. Sometimes, they even do a better job than human coders can do in assembly language!
Here is a simplified representation of the compiling process:


An interpreter is a program that directly executes your code without compiling it into machine code first. Interpreters tend to be more flexible, but are less efficient when running programs because the interpreting process needs to be done every time the program is run. This means the interpreter is needed every time the program is run.
Here is a simplified representation of the interpretation process:



Any language can be compiled or interpreted, however, traditionally languages like C, C++, and Pascal are typically compiled, whereas “scripting” languages like Perl and JavaScript are interpreted. Some languages, like Java, use a mix of the two.High level languages have several desirable properties.
First, high level languages are much easier to read and write.
Here is the same instruction as above in C/C++: a = 97;
Second, they require less instructions to perform the same task as lower level languages. In C++ you can do something like a = b * 2 + 5; in one line. In assembly language, this would take 5 or 6 different instructions.
Third, you don’t have to concern yourself with details such as loading variables into CPU registers. The compiler or interpreter takes care of all those details for you.
And fourth, they are portable to different architectures, with one major exception, which we will discuss in a moment.






More about computer languages       
A language is defined as the medium of expression of thoughts. All the human beings in this world communicate with each other by a language. Similarly, computer also needs some expression medium to communicate with others
A computer follows the instructions given by the programmer to perform a specific job. To perform a particular task, programmer prepares a sequence of instructions, known as programmed. A program written for a computer is known as Software. The programmed is stored in RAM. The CPU takes one instruction of the programmed at a time from RAM and executes it. The instructions are executed one by one in sequence and finally produce the desired result.
1)   FIRST GENERATION LANGUAGES 1GLs (Machine language)
When the human being stared programming the computer the instruction were given to it in a language that it could easily understand. And that language was machine language. The binary language a language, a language of Is and Os is known as Machine language. Any instruction in this language is given in the form of string of 1s and 0s. Where the symbol I stand for the presence of electrical pulse and 0 stands for the absence of electric pulse. A set of 1s and 0s as 11101101 has a specific meaning to a computer even through it appears as binary number to us.
The writing of programmer in machine language is very cumbersome and complicated and this was accomplished by expert only. All the instruction and imp data are to fed to the computer in numeric form that is binary form.
2)    SECOND GENERATION LANGAUAGES 2GLs (Assembly Language)
Lots of efforts are made during last 50 years to obviate the difficulties faced for using the machine language. The first language similar to English was developed in 1950 which was known as Assembly Language or Symbolic Programming Languages. After 1960, the High Level Languages were developed which bought the common man very to the computer. And this was the main reason for tremendous growth in computer industry. The high level languages are also known as Procedure Oriented Languages.
3)   THIRD GENERATION LANGUAGES (3GLs ) (High Level Languages)
The assembly language was easier to use compared with machine la language as it relieved the programmer from a burden of remembering the operation – codes and addresses of memory location. Even though the assembly languages proved to be great help to the programmer, a search was continued for still better languages nearer to the conventional English language. The languages developed which were nearer to the English language, for the use of writing the programmer in 1960 were known as High Level languages. The different high level languages which can be used by the common user are FORTRAN, COBOL, BASIC, PASCAL, PL-1 and many others. Each high level language was developed to fulfill some basic requirements for particular type of problems. But further developments are made in each language to widen its utility for different purposes.
4)   FOURTH GENERATION LANGUAGES (4GLs)
The 3GLs are procedural in nature i.e., HOW of the problem get coded i.e., the procedures require the knowledge of how the problem will be solved. Contrary to them, 4GLs are non-procedural. That is only WHAT of the problem is coded i.e., only ‘What is required’ is to be specified and rest gets done on its own. Thus a big program of a 3GLs may get replaced by a single statement of a 4GLs. The main aim of 4GLs is to be cut down on developed and maintenance time and making it easier for users.
GUI BASED LANGAUAGES:
With the invention and popularity of GUI based interfaces. GUI based languages are as follows:
1) Visual basic
2) Visual C++
3) C# (Pronounced as C sharp)
4) Visual basic.NET
5) Visual basic 2005

LANGUAGE:
(1) Low level language
      (a) Machine language
      (b) Assembly language
(2) High level language
        (a) Basic
        (b) Cobol
        (c) Fortran
        (d) Pascal
        (e)Python
        (f)Ruby
        (g)PHP
        (h)Perl
        (i)COBOL









Comments

Popular posts from this blog

C Program to Display the ATM Transaction

Java programming language

Python Program to Print all Prime Numbers in an Interval