# 2nd-generation programming language

> easily readable and written by programmers and uses mnemonics; is changed by assemblers

**Wikidata**: [Q18657800](https://www.wikidata.org/wiki/Q18657800)  
**Wikipedia**: [English](https://en.wikipedia.org/wiki/Second-generation_programming_language)  
**Source**: https://4ort.xyz/entity/2nd-generation-programming-language

## Summary
A **2nd-generation programming language (2GL)** is a type of programming language that uses mnemonics and is designed to be more readable and writable by programmers than binary machine code. It is processed by assemblers to convert human-readable instructions into executable machine code.

## Key Facts
- **Classification**: Subclass of *programming language*, specifically known as *assembly language*.
- **Generation**: Follows *1st-generation programming languages* (binary machine code) and precedes *3rd-generation programming languages* (high-level languages).
- **Readability**: Uses mnemonics (e.g., `MOV`, `ADD`) instead of binary or hexadecimal codes.
- **Translation**: Requires an *assembler* to convert instructions into machine-executable code.
- **Aliases**: Also referred to as *second-generation programming language*, *2GL*, *L2G*, or *Segunda geração de linguagens de programação* (Portuguese).
- **Wikidata Presence**: Listed with a *sitelink count* of 11 and a *Freebase ID* of `/m/02_hgr`.
- **Wikipedia Coverage**: Available in 10 languages, including English, Arabic, and Hungarian.

## FAQs
### Q: What is the main difference between 1st and 2nd-generation programming languages?
A: **1st-generation languages** use binary machine code, while **2nd-generation languages** (assembly) use human-readable mnemonics that are converted to machine code by assemblers.

### Q: What comes after 2nd-generation programming languages?
A: **3rd-generation programming languages**, which are high-level languages (e.g., C, Java) that abstract hardware details further.

### Q: Are 2nd-generation languages still used today?
A: Yes, assembly language (a 2GL) is still used in low-level programming, embedded systems, and performance-critical applications.

### Q: What tool processes 2nd-generation programming languages?
A: An **assembler** translates assembly code (2GL) into machine code for execution.

## Why It Matters
2nd-generation programming languages bridged the gap between raw machine code and high-level languages, making programming more accessible while retaining control over hardware. Before 2GLs, programmers had to write in binary (1GL), which was error-prone and tedious. Assembly language introduced mnemonics (e.g., `JMP` for "jump"), simplifying development without sacrificing performance. This advancement was crucial for early computer science, enabling faster software development and debugging. Today, 2GLs remain essential for tasks requiring direct hardware manipulation, such as device drivers, firmware, and reverse engineering. Their influence persists in modern compilers and low-level optimizations.

## Notable For
- **First human-readable programming paradigm**: Replaced binary with mnemonics, reducing errors and improving productivity.
- **Direct hardware control**: Allows precise manipulation of CPU registers and memory, critical for system-level programming.
- **Foundation for modern languages**: Concepts like symbolic addressing in 2GLs influenced higher-level languages.
- **Assembler dependency**: Requires a dedicated tool (assembler) to translate code, distinguishing it from 1GL and 3GL.
- **Longevity**: Still used in niche domains (e.g., embedded systems) despite the dominance of high-level languages.

## Body
### Definition and Characteristics
A **2nd-generation programming language (2GL)** is a low-level language that uses **mnemonics** (short abbreviations) to represent machine instructions. Unlike 1GL (binary), it is designed for human readability while maintaining a 1:1 correspondence with machine code. Key traits include:
- **Symbolic representation**: Commands like `LOAD`, `STORE`, or `ADD` replace binary opcodes.
- **Assembler reliance**: Requires an assembler to convert instructions into executable machine code.
- **Hardware-specific**: Code is tied to a particular CPU architecture (e.g., x86, ARM).

### Historical Context
- **Predecessor**: 1GL (binary machine code), used in early computers like ENIAC.
- **Successor**: 3GL (high-level languages like Fortran, COBOL), which abstracted hardware details further.
- **Transition**: 2GLs emerged as computers became more complex, necessitating a balance between control and usability.

### Technical Workflow
1. **Writing**: Programmers write code using mnemonics (e.g., `MOV AX, 5`).
2. **Assembly**: An assembler translates the code into machine code (binary).
3. **Execution**: The CPU runs the compiled binary directly.

### Modern Usage
While largely superseded by high-level languages, 2GLs remain relevant in:
- **Embedded systems**: Microcontrollers often require assembly for efficiency.
- **Reverse engineering**: Analyzing malware or legacy systems.
- **Performance optimization**: Critical loops in high-performance applications (e.g., game engines).

### Relationship to Assembly Language
- **Permanent duplication**: Wikidata lists *assembly language* as a duplicate of 2GL, confirming their equivalence.
- **Variants**: Different CPUs have unique assembly dialects (e.g., x86 vs. MIPS).

## Schema Markup
```json
{
  "@context": "https://schema.org",
  "@type": "Thing",
  "name": "2nd-generation programming language",
  "description": "A programming language using mnemonics, designed for readability and processed by assemblers.",
  "sameAs": [
    "https://www.wikidata.org/wiki/Q207448",
    "https://en.wikipedia.org/wiki/Second-generation_programming_language"
  ],
  "additionalType": "https://www.wikidata.org/wiki/Q9143" // Programming language
}

## References

1. Freebase Data Dumps. 2013
2. [OpenAlex](https://docs.openalex.org/download-snapshot/snapshot-data-format)