💻

Introduction to Programming Languages

Jun 18, 2024

Introduction to Programming Languages

Summary of Previous Lecture

  • Need for programming: Computers require instructions to perform tasks, known as programs.
  • Types of Programs: System programs, application programs.
  • Binary Language: Computers understand binary language (0s and 1s).
  • Conversion: Programs in languags like C, C++, Java need to be converted to machine code (0s and 1s) for the CPU to execute.

Levels of Programming Languages

  • Categories: Low-level programming languages, High-level programming languages.

Low-Level Programming Languages

  1. Machine Language (Machine Code) / Machine Level Language

    • Characteristics: Very close to hardware, machine-oriented, written in binary (0s and 1s).
    • Requirement: Extensive knowledge of CPU architecture and system configuration.
    • Programming: Instructions in machine code are specific to CPU architecture.
    • Advantages: Direct execution by computer, fast execution.
    • Drawbacks: Not readable by humans, machine-dependent, not portable.
  2. Assembly Language

    • Characteristics: Uses symbols and numbers (mnemonics) like ADD, SUB, MOV.
    • Conversion: Requires conversion to machine code by an assembler.
    • Advantages: More readable by humans, close to machine language.
    • Drawbacks: Slower than machine language due to need for conversion, still machine-dependent, not portable.

High-Level Programming Languages

  • Examples: C, C++, Java, Python, Perl, PHP, Ruby, etc.
  • Characteristics: Close to human language, deals with variables, functions, loops, mathematical expressions.
  • Advantages: Easier to read, write, understand, and maintain; independent of CPU architecture.
  • Drawbacks: Requires conversion to machine code by a compiler or interpreter, slower execution compared to machine language.

Conversion Tools

  1. Compiler
    • Takes entire source code and converts it to machine code (object file) before execution.
  2. Interpreter
    • Converts and executes source code line by line simultaneously.

Key Concepts

  • High-Level Languages: Focus on usability, not optimal program efficiency.
  • Portability: Programs are more or less independent of computer system architecture.

Conclusion

  • Next lecture will cover writing programs in C language and the execution process behind the scenes.