Programming Languages
Introduction
A programming language is a language used to write instructions that tell a computer what
to do. These instructions are called programs. A computer understands only machine
language (0s and 1s), but programming languages help humans write instructions in an easy
and understandable way.
Definition
Programming Language:
A programming language is a formal language consisting of symbols, keywords, and rules
(syntax) used to write computer programs that instruct a computer to perform specific tasks.
Example:
• To add two numbers
• To print a student’s marks
• To create a website
• To develop a mobile application
Need for Programming Languages
Without programming languages, it would be almost impossible for humans to communicate
with computers.
Programming languages are needed to:
• Develop software and applications
• Create websites
• Design games
• Perform calculations
• Store and process data
• Control machines and robots
• Develop Artificial Intelligence (AI)
Characteristics of a Good Programming
Language
A good programming language should have the following features:
1. Simple
Easy to learn and understand.
2. Readable
Programs should be easy for humans to read.
3. Portable
Programs should run on different computers with little or no changes.
4. Efficient
Programs should execute quickly and use less memory.
5. Reliable
Programs should produce accurate results.
6. Secure
It should protect programs and data from errors.
7. Maintainable
Programs should be easy to modify and update.
Types of Programming Languages
Programming languages are mainly divided into three generations:
1. Machine Language (1GL)
Machine language is the lowest-level programming language.
It consists only of:
• 0 (Zero)
• 1 (One)
Example:
10110110
00101010
11110000
The CPU understands only machine language directly.
Advantages
• Fastest execution
• No translator required
• Directly understood by the computer
Disadvantages
• Very difficult to write
• Difficult to debug
• Time-consuming
• Machine dependent
2. Assembly Language (2GL)
Assembly language uses mnemonic codes instead of binary numbers.
Examples:
• ADD
• SUB
• MOV
• MUL
Example:
MOV A, B
ADD A, C
An Assembler converts assembly language into machine language.
Advantages
• Easier than machine language
• Faster execution
• Uses symbols instead of binary
Disadvantages
• Machine dependent
• Difficult for large programs
• Requires an assembler
3. High-Level Language (3GL)
High-level languages are similar to English and are much easier for humans to understand.
Examples:
• C
• C++
• Java
• Python
• BASIC
• Pascal
Example (Python):
print("Hello World")
Example (C):
printf("Hello World");
A Compiler or Interpreter converts high-level language into machine language.
Advantages
• Easy to learn
• Easy to write
• Easy to debug
• Portable
• Suitable for large software development
Disadvantages
• Slower than machine language
• Requires a compiler or interpreter
Fourth Generation Languages (4GL)
Fourth Generation Languages are designed for database management and report generation
with very little coding.
Examples:
• SQL
• MATLAB
• SAS
Advantages
• Less coding
• Faster application development
• User-friendly
Uses
• Database management
• Data analysis
• Report generation
Fifth Generation Languages (5GL)
Fifth Generation Languages are mainly used in Artificial Intelligence (AI) and Expert
Systems.
Examples:
• Prolog
• Mercury
Uses
• AI applications
• Robotics
• Machine learning
• Natural language processing
Language Translators
Since computers understand only machine language, translators convert programs into
machine code.
1. Compiler
A compiler converts the entire program into machine language at once.
Characteristics
• Faster execution after compilation
• Reports all errors together
• Produces an executable file
Examples:
• C Compiler
• C++ Compiler
Advantages
• Fast execution
• Better performance
• Suitable for large programs
2. Interpreter
An interpreter translates and executes one statement at a time.
Characteristics
• Executes line by line
• Stops when an error occurs
• No executable file is created
Examples:
• Python
• JavaScript
Advantages
• Easy debugging
• Immediate execution
• Good for beginners
3. Assembler
An assembler converts assembly language into machine language.
Example: ADD A,B—-> 11010001
Compiler vs Interpreter
Compiler Interpreter
Converts whole program Converts one line at a time
Faster execution Slower execution
Reports all errors together Stops at the first error
Creates executable file Does not create executable file
Example: C, C++ Example: Python, JavaScript
Comparison of Programming Languages
Machine Assembly High-Level
Feature
Language Language Language
English-like
Uses 0 and 1 Mnemonics
statements
Easy to Learn No Moderate Yes
Speed Very High High Moderate
Machine
Yes Yes Mostly No
Dependent
Translator Needed No Assembler Compiler/Interpreter
Applications of Programming Languages
Programming languages are used in many fields:
1. Software development
2. Website development
3. Mobile app development
4. Banking systems
5. Railway reservation systems
6. Hospital management systems
7. Education
8. Artificial Intelligence
9. Robotics
10. Scientific research
11. Cybersecurity
12. Game development
Advantages of Programming Languages
• Easy communication with computers
• Faster software development
• Reduces human effort
• Improves productivity
• Supports automation
• Easy maintenance and updates
• Solves complex problems
Disadvantages
• Requires programming knowledge
• Errors (bugs) may occur
• Debugging can take time
• Some languages require expensive software or tools
• Programs need regular updates and maintenance