0% found this document useful (0 votes)
49 views7 pages

Part 03 - Lesson 1 Introduction To Computer (Cont.)

A programming language is a set of commands that allows humans to communicate instructions to computers. There are many programming languages that are used for different purposes like website development, app creation, and data analysis. Programming languages need to be translated into machine-readable code since computers only understand binary.

Uploaded by

Nut Youlong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views7 pages

Part 03 - Lesson 1 Introduction To Computer (Cont.)

A programming language is a set of commands that allows humans to communicate instructions to computers. There are many programming languages that are used for different purposes like website development, app creation, and data analysis. Programming languages need to be translated into machine-readable code since computers only understand binary.

Uploaded by

Nut Youlong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

What is a Programming Language?

A programming language is a set of commands, instructions and symbols that can be used to
interact with and control a computer. There are many programming languages such as C, C++,
Java, Python, PHP, JavaScript, or some other languages. These languages are used to design
websites, create apps, develop operating systems, control spacecraft, and analyze data.
Programming languages are necessary because computers can't understand English.
Programming languages bridge this gap by helping programmers translate their commands into
something that the computer can understand and execute.

How many generations of programming languages are there?


The programming language in terms of their performance reliability and robustness can be
grouped into five different generations,

1. First generation languages (1GL)


2. Second generation languages (2GL)
3. Third generation languages (3GL)
4. Fourth generation languages (4GL)
5. Fifth generation languages (5GL)

1. First Generation Language (Machine language):


The first-generation programming language is also called low-level programming language
because they were used to program the computer system at a very low level of abstraction.
i.e., at the machine level. The machine language also referred to as the native language of
the computer system is the first-generation programming language. In the machine
language, a programmer only deals with a binary number.
Advantages:
• Fast & efficient as statements are directly written in binary language.
• No translator is required.

Disadvantages:

• Difficult to learn binary codes.


• Difficult to understand – both programs & where the error occurred.
2. Second Generation language (Assembly Language):
The first step in making software development easier and more efficient was the creation of
Assembly languages. They are also classified as low-level languages because detailed
knowledge of hardware is still required. Assembly languages use mnemonic operation codes
and symbolic addresses in place of 1s and 0s to represent the operation codes. A mnemonic
is an alphabetical abbreviation. This means a programmer can use abbreviation instead of
having to remember lengthy binary instruction codes. For example, it is much easier to
remember L for Load A for Add, B for Branch, and C for Compare than the binary equivalents
i-e different combinations of 0s and 1s. Assembler – converts assembly level instructions to
machine-level instructions.

Advantages:

• It is easier to understand if compared to machine language.


• Modifications are easy.
• Correction & location of errors are easy.

Disadvantages:

• Assembler is required.
• This language is architecture /machine-dependent, with a different instruction set
for different machines.
3. Third Generation Language:
The third generation is also called procedural language /3 GL. It consists of the use of a
series of English-like words that humans can understand easily, to write instructions. It’s
also called High-Level Programming Language. For execution, a program in this language
needs to be translated into machine language using a Compiler/ Interpreter. Examples of
this type of language are C, PASCAL, FORTRAN, COBOL, C++, Java, JavaScript etc.

Advantages:

• Use of English-like words makes it a human-understandable language.


• Lesser number of lines of code as compared to the above 2 languages.
• Same code can be copied to another machine & executed on that machine by using
compiler-specific to that machine.

Disadvantages:

• Compiler/ interpreter is needed.


• Different compilers are needed for different machines.

4. The fourth-generation languages:

Fourth generation languages are also known as very high-level languages. They are non-
procedural languages, so named because they allow programmers and users to specify what
the computer is supposed to do without having to specify how the computer is supposed to
do it. Consequently, fourth generation languages need approximately one tenth the number
of statements that a high-level language needs to achieve the same results. Because they
are so much easier to use than third generation languages, fourth generation languages
allow users, or non-computer professionals, to develop software. Fourth generation
languages are commonly used in database programming and scripts examples include Perl,
PHP, Python, Ruby, and SQL.

Advantages:
• Easy to understand & learn.
• Less time is required for application creation.
• It is less prone to errors.

Disadvantages:

• Memory consumption is high.


• Has poor control over Hardware.
• Less flexible.

5. Fifth Generation Language:


The fifth-generation languages are also called 5GL. It is based on the concept of artificial
intelligence. It uses the concept that rather than solving a problem algorithmically, an
application can be built to solve it based on some constraints, i.e., we make computers learn
to solve any problem. Parallel Processing & superconductors are used for this type of
language to make real artificial intelligence. Examples: Mercury, OPS5, PROLOG, LISP, etc.

Advantages:
• Machines can make decisions.
• Programmer effort reduces to solve a problem.
• Easier than 3GL or 4GL to learn and use.

Disadvantages:
• Complex and long code.
• More resources are required & they are expensive too.

Programming languages vs scripting languages


Scripting languages are in a special category within programming languages. Programming
languages are languages created for communicating with computers, through which we give
instructions to the computer to make them perform certain tasks. This is also true for scripting
languages.

Programming languages

Programming languages are languages created for communicating with computers, through
which we give instructions to the computer to make them perform certain tasks.

These languages cannot be interpreted by the computers directly, since the language of
computers is a binary code that consists of 1s and 0s. We need to translate the programming
languages that are closer to human languages into machine code. This is done by special
translation tools called compilers.

Here are some popular programming languages: C, C++, C#, Java, Kotlin, Swift.
Scripting languages

We can define scripting languages in a way that might be hard to understand at first glance:
“scripting languages are programming languages that are being translated with an interpreter
during runtime, not with a compiler before running it.” If we want to approach it in a practical
way, scripting languages are programming languages, that are designed to make code easy to
write and modify. They are one step closer to human languages than other programming
languages, making it easier to interpret. they run much slower than other programming
languages. The reason for this “slowness” is the method of interpretation these languages use.
Here are some popular scripting languages: JavaScript, PHP, Perl, Ruby, Python.

Programming languages Scripting languages


(Use compilers) (Use interpreter)

Input The code is read as a whole The code is read line by line

Output It generates an object code between the There is no intermediate step between
input and the output
input and output

Mechanism The compilation is done before the execution Interpretation and execution are done
of the code (with a compiler)
simultaneously (with an interpreter)

Speed Faster in comparison Slower

Memory Needs more memory because of the object Requires a smaller amount of memory,
code
because no object code is generated

Errors Errors are displayed after compilation, all at Errors are displayed one by one, line by line
the same time

Error More difficult in comparison Easier


detection

Examples C, C++, C#, Go, Java, Kotlin, Rust, Swift, JavaScript, PHP, Perl, Ruby, Python
Objective-C
Flow diagram of a program in the compilation process in C, C++

We have a C Program file with an extension of .c, i.e. hello.c file.

• Step 1 -- is preprocessing of header files, all the statements starting with # (hash
symbol) and comments are replaced/removed during the pre-processing with the help
of a pre-processor. It generates an intermediate file with .i file extension i.e.
a hello.i file.

• Step 2 -- is a compilation of hello.i file. Compiler software translates the hello.i file
to hello.s with assembly level instructions (low-level code).
• Step 3 -- assembly-level code instructions are converted into machine-understandable
code (binary/hexadecimal form) by the assembler. The file generated is known as the
object file with an extension of .obj/.o i.e. hello.obj/hello.o file.

• Step 4 -- Linker is used to link the library files with the object file to define the unknown
statements. It generates an executable file with .exe/.out extension i.e.
a hello.exe/hello.out file.

• Next, we can run the hello.exe/hello.out executable file to get the desired output on our
output window, i.e., Hello World!.

You might also like