Computer Programming Languages and Translators Note

Computer Programs and Syntax

  • A computer program is a collection of instructions executed by a computer to perform specific tasks.

  • Programmers write source code using programming languages such as C++, Java, or Python, while Integrated Development Environments (IDES) help write programs across various languages.

  • Computers process instructions in binary language (0s and 1s), which is difficult for humans to write directly.

  • Syntax is a specific set of keywords, words, characters, and rules that tells a computer how to read, interpret, and convert code into tasks.

  • Text-based languages rely on character sequences (e.g., cout << "Hello World"; in C++ displays "Hello World" on the screen), whereas visual programming languages like Visual Basic are based on symbol layouts and connections.

  • Failure to follow proper syntax rules prevents program execution and results in syntax errors.

Classification of Programming Languages

  • Low-Level Languages: Directly access hardware and memory, represented in binary (0 or 1).

    • Machine-Level Language: First-generation language written in binary digits (0 and 1); has direct hardware access and executes directly without requiring a translator; non-portable.

    • Assembly Language: Second-generation language written in simple English language; has lesser hardware access and requires an assembler to convert assembly code into machine code.

  • Middle-Level Languages: Formerly acted as a bridge between hardware and user interaction, but are now obsolete and no longer used.

  • High-Level Languages: Revolutions in programming that are closer to human languages, written in English-like words, portable (machine-independent), and easier to read, write, and maintain, but lack direct hardware access, are less memory efficient, and require a compiler or interpreter.

Types and Roles of Translators

  • Source Code: Program written in any high-level or low-level programming language.

  • Translators: Programs that take source code as input and convert it into target machine language (binary) as output.

  • Key Roles of Translators:

    • Translate program input into an equivalent machine language program.

    • Detect errors and provide alert messages whenever syntax rules are not followed.

  • Translator Types:

    • Assembler: Translates assembly language code into machine code.

    • Compiler: Translates high-level language source code into machine code.

    • Interpreter: Translates high-level language instructions into machine code.