2. PROGRAMMING LANGUAGE
A programming language is a formal language that specifies a set of
instructions that can be used to produce various kinds of output. Programming
languages generally consist of instructions for a computer.
Programming languages can be used to create programs that implement
specific algorithms.
There are programmable machines that use a limited set of specific instructions,
rather than the general programming languages of modern computers.
Early ones preceded the invention of the digital computer, the first probably
being the automatic flute player described in the 9th century by the brothers
Musa in Baghdad, during the Islamic Golden Age.
From the early 1800s, programs were used to direct the behavior of machines
such as Jacquard looms, music boxes and player pianos.
However, their programs (such as a player piano's scrolls) could not produce
different behavior in response to some input or condition.
3. Types of Languages
• There are three main kinds of programming language:
• Low –level language
• 1. Machine language
• 2. Assembly language
• High-level language
4. Machine language
• We just went over what machine language is - it's the language of machines,
consisting of bits (1s and 0s) put together into chunks like bytes, a group of 8
bits, and lots of other larger sizes.
• It's highly unlikely you will ever have to write in machine language, but in the
old days, we used to plot 1s and 0s on graph paper and then type them in, to
make pictures appear on the computer screen. Very tedious!
• The activation of specific electrical inputs (e.g., CPU package pins for
microprocessors), and logical settings for CPU state values, control the
processor's computation.
• Individual machine languages are specific to a family of processors; machine-
language code for one family of processors cannot run directly on processors
in another family unless the processors in question have additional hardware
to support it (for example, DEC VAX processors included a PDP-11
compatibility mode).
• They are (essentially) always defined by the CPU developer, not by 3rd
parties.
5. Machine language
• Advantages
1. Machine language makes most efficient use of computer system resources like
storage, registers, etc.
2. the instruction of a machine language program are directly executable so
there is no need of translators.
3. Machine language instruction can be used to manipulate the individual bits
in a computer system with high execution speed due to direct manipulation
of memory and registers.
• Drawbacks
1. Machine languages are machine dependent and, therefore, programs are not
portable from one computer to other.
2. Programming in machine language usually results in poor programmer
productivity.
3. Machine languages require programmers to control the use of
each register in the computer’s Arithmetic Logic Unit and computer storage
locations must be addressed directly, not symbolically.
6. Assembly language
• Assembly language is a little easier than machine language, but not much!
It uses more convenient numbers, symbols, and abbreviations to describe
the huge strings of 1s and 0s, to make it both easier and more memorable
to type in instructions.
• The computer knows that certain strings of numbers are commands, so
assembly language lets you use English-like strings instead of numbers to
refer to those.
• Plus, with assembly language you have access to all kinds of resources to
organize your programming code.
• Then you tell a program called an assembler to assemble your instructions,
which just means they get turned into 1s and 0s for you.
7. Assembly language
• Advantages
1. Assembly language provide optimal use of computer resources like registers and
memory because of direct use of these resources within the programs.
2. Assembly language is easier to use than machine language because there is no need
to remember or calculate the binary equivalents for opcode and registers.
3. An assembler is useful for detecting programming errors.
4. Assembly language encourages modular programming which provides the facility of
reusable code, using macro.
• Drawbacks
1. Assembly language programs are not directly executable due to the need of
translation.
2. Also, these languages are machine dependent and, therefore, not portable from one
machine to another.
3. Programming in assembly language requires a high level of programming skills and
knowledge of computer architecture of the particular machine.
8. High-level language
• The third type of language are the high-level languages. These
languages use English-like statements and symbols, and are
independent of the type of computer you are using.
• You can even put in lots of English labels and comments to help
remember what the instructions are doing. This makes your programs
much easier to read and modify.
• There are far more high-level languages than any other type of
computer language, each one tailored for a certain kind of use.
• High Level Programming Languages are the programming languages
that provide a strong abstraction and have a simple and easy syntax.
• For example - Python, Java, C, C++, Ruby, Perl, Python, Basic, JavaScript
and many more.
9. High-level language
• Advantages of High Level Languages
1. These are the third generation languages.
2. These are procedure-oriented languages and are machine independent.
3. Programs are written in English like statements.
4. As high level languages are not directly executable, translators(compilers and
interpreters) are used to convert them in machine language equivalent.
• Limitation of Programming language
1. A long sequence statements is to be written for every program.
2. Additional memory space is required for storing compiler or interpreter.
3. Execution time is very high as the HLL programs are not directly executable.