Introduction to Computer Programming Languages and Compilation Pipeline

Evolution of Programming Languages and Binary Code

  • Historical Context of Binary Programming:

    • In the 1960s, when the first computers were manufactured in the United States, software programming was performed directly in low-level binary code.

    • Programmers were forced to read, memorize, and manually decipher extremely long sequences of binary digits consisting entirely of zeros and ones (such as 0001100000011000).

  • Challenges of Low-Level Binary Readability:

    • Reading binary strings requires memorizing fixed code patterns (such as 0000) and knowing precisely where to segment or cut the sequence to decipher its meaning.

    • Finding bugs, errors, or misaligned bits—such as accidentally inserting or removing a single 00 or 11—was extraordinarily difficult and time-consuming.

Assembly Language and the Assembler

  • Development of Assembly Language:

    • To overcome the severe limitations of binary programming, assembly language was created.

    • Assembly language incorporates recognizable English words and mnemonics, making it significantly easier for human programmers to read and write.

  • The Translation Necessity:

    • Human programmers can easily read assembly language, but computer hardware cannot understand or execute it directly.

    • Computer science adapted the human linguistic concept of translation (analogous to translating between Chinese and English).

    • The specialized software tool that translates assembly language instructions into machine-readable binary code is called an assembler.

High-Level Languages, Compilers, and File Types

  • High-Level Languages:

    • Modern computing uses high-level languages to provide strong abstraction from hardware details, making software development efficient and accessible.

  • Source Program (Source Code):

    • The original program code written by a software engineer in a high-level language (such as C++) is called the source program.

    • The window in an editor or integrated development environment (IDE) where this code is written is called the source program window.

  • The Compiler:

    • A compiler is a program that translates high-level source code into machine language.

  • Object Program (Object File):

    • The translated output produced by the compiler is called the object program.

    • If an object program file is opened directly in a text viewer, it displays only raw binary machine language (continuous strings of 00s and 11s, such as 000111000111) and no readable text.

Practical Application and Workflow

  • Standard Compilation Pipeline:

    1. Write Source Program: Draft high-level code (e.g., C++) while carefully managing logic and syntax.

    2. Compile: Execute the compiler software to translate high-level commands into low-level machine instructions.

    3. Generate Object Program: The compiler creates the final object program containing binary code ready for hardware execution.

  • C++ Stream Manipulators and Resources:

    • C++ programs frequently utilize stream manipulators such as endl (end line) for formatting output streams.

    • Reference implementations, sample source programs, and usage guides are provided via the Blackboard platform.