Curriculum
Course: Learn C++
Login

Curriculum

Learn C++

Text lesson

Introduction to Computer Programming Languages

In this lesson, you will learn.

  • What is a Programming Language?
  • History and Generation of Programming Language
  • Translators or Language Processors

 

What is a Programming Language?

A programming language is a system of notation for writing computer programs.

Programming languages are used in computer programming to implement algorithms. They enable humans to communicate with computers in a way that the machines can understand and execute.

ProgrammingLanguage

Image Source: mycplus

 

Generations of Programming Languages

Programming languages have evolved through several generations, each offering higher levels of abstraction and ease of use.

Languagegenerations

 

1. First Generation (1GL) – Machine Language

History and Characteristics:

  • Time: 1940s-1950s
  • Description: The first generation of programming languages is machine language, consisting of binary code (0s and 1s) that is directly understood by the computer’s hardware. Each instruction is coded in a binary format specific to the hardware architecture.
  • Example:
    • Machine code for the Intel x86 processor might look like 10110000 01100001, where 10110000 is the instruction to move data, and 01100001 is the data to be moved.

Usage:

  • Used for early computers like ENIAC and UNIVAC.
  • Extremely fast execution but difficult and error-prone for human programmers.

 

2. Second Generation (2GL) – Assembly Language

History and Characteristics:

  • Time: 1950s-1960s
  • Description: Assembly language is a low-level programming language that uses symbolic code or mnemonics (e.g., MOV, ADD, SUB) to represent machine-level instructions. Each assembly language instruction corresponds directly to a single machine language instruction.
  • Example:
    • An assembly instruction for the x86 architecture might look like MOV AL, 61h, which moves the hexadecimal value 61 into the register AL.

Usage:

  • Used for early microprocessors and systems programming.
  • Easier than machine code but still hardware-specific and requires detailed knowledge of the hardware.

 

3. Third Generation (3GL) – High-Level Languages

History and Characteristics:

  • Time: 1950s-present
  • Description: High-level languages are more abstract and closer to human language, making them easier to learn and use. They allow programmers to write instructions that are translated into machine code by compilers or interpreters.
  • Examples:
    • Fortran (1957): Designed for scientific and engineering calculations.
    • COBOL (1959): Designed for business data processing.
    • C (1972): General-purpose language used in system and application programming.
    • Java (1995): Object-oriented language designed for portability across platforms.

Usage:

  • Used for a wide range of applications, from business software to system software and games.
  • Improved productivity and maintainability of code.

 

4. Fourth Generation (4GL) – Very High-Level Languages

History and Characteristics:

  • Time: 1970s-present
  • Description: Fourth-generation languages are even higher-level and often domain-specific, designed to be closer to natural language or to allow specific types of data processing tasks to be expressed concisely.
  • Examples:
    • SQL (1974): Language for managing and manipulating relational databases.
    • MATLAB (1984): Used for numerical computing and algorithm development.
    • Oracle Reports (1980s): Used for generating reports from databases.

Usage:

  • Used in database querying, report generation, and data analysis.
  • Focus on reducing programming effort and increasing productivity.

 

5. Fifth Generation (5GL) – Artificial Intelligence Languages

History and Characteristics:

  • Time: 1980s-present
  • Description: Fifth-generation languages are based on solving problems using constraints given to the program, rather than using a step-by-step procedure. They are often used in artificial intelligence research and development.
  • Examples:
    • Prolog (1972): Used for logic programming and AI applications.
    • LISP (1958): Used for AI research, especially in natural language processing and machine learning.

Usage:

  • Used in AI, expert systems, and complex problem-solving applications.
  • Focus on enabling computers to solve problems without human intervention.

 

 

Translators or Language Processors

A program written in a high-level language is known as source code that is not understandable by the machine. It must be translated into a machine-understandable form before running.

A translator is a computer program that converts source code into machine code that the computers understand and process.

Generally, there are three types of translators:

Translators

1. Compiler

  • A compiler translates the entire source code of a high-level programming language into machine code before execution.
  • The process involves several stages: lexical analysis, syntax analysis, semantic analysis, optimization, and code generation.

Compiler

Examples:

  • GCC (GNU Compiler Collection): Compiles languages like C, C++, and Fortran.
  • javac: The Java compiler that translates Java source code into bytecode.
  • Clang: A compiler for the C language family (C, C++, Objective-C).

Usage:

  • Suitable for programs that need to be executed multiple times, as the translation happens once, and the machine code can be executed repeatedly.
  • Examples: System software, application software, and games.

 

 

2. Interpreter

  • An interpreter translates and executes code line by line. It does not produce an intermediate machine code file.
  • Each line of code is read, translated to machine code, and executed immediately.

Interpreter

Examples:

  • Python Interpreter: Executes Python code.
  • Ruby Interpreter: Executes Ruby code.
  • JavaScript Engines (like V8 in Chrome): Executes JavaScript code.

 

Usage:

  • Suitable for scripting and scenarios where code is executed only once or needs to be tested frequently.
  • Examples: Web scripting, automation scripts, prototyping.

 

3. Assembler

  • An assembler translates assembly language code into machine code.
  • Assembly language is a low-level programming language that uses mnemonics to represent machine instructions.
  • The output of an assembler is a machine code file that can be executed by the computer’s CPU.

Assembler

Examples:

  • NASM (Netwide Assembler): Assembles code for x86 architecture.
  • MASM (Microsoft Macro Assembler): Assembles code for Microsoft platforms.
  • GAS (GNU Assembler): Part of the GNU Binutils package, assembles code for various architectures.

Usage:

  • Used for writing system software, device drivers, and real-time applications where performance and hardware control are critical.
  • Examples: Operating systems, embedded systems, firmware.

 

 


 

End of the lesson….enjoy learning

 

 

Student Ratings and Reviews

 

5.0
5.0 out of 5 stars (based on 1 review)
Excellent100%
Very good0%
Average0%
Poor0%
Terrible0%

 

 

August 26, 2024

all set

 

 

Submit a Review