Q.1
14 Marks1. Semantic Gap:
The distance between the semantics of problem domain concepts (high-level logic) and execution domain concepts (machine instructions, registers, bit sequences). System software reduces this gap.
2. Specification Gap:
The difference between the specification of a problem (e.g., formal requirements or design) and the programming language constructs used to express the solution.
3. Execution Gap:
The difference between the semantics of the source programming language and the machine architecture that executes the program. Bridging this gap is the core objective of language processors (compilers/assemblers).
Role of Symbol Table (SYMTAB)
- Definition & Storage: Created by the assembler to record every user-defined identifier (labels, variable names) along with its allocated memory address, length, and relocation attribute.
- Resolution: During Pass 1, addresses are assigned as labels are defined. During Pass 2, SYMTAB is queried to substitute operand label names with their assigned binary addresses.
Role of Literal Table (LITTAB)
- Definition & Storage: Stores literals (constants written directly in instructions, e.g.,
='5') encountered in the source code along with their assigned target addresses. - Allocation & Pool Handling: Literals are assigned memory locations when an
LTORGorENDdirective occurs. The assembler references LITTAB in Pass 2 to generate machine representations for constant operands.
Define System Software. Explain the Life Cycle of a Source Program with a neat diagram.
Definition of System Software
System software consists of a collection of programs that manage, control, and support computer hardware operations and facilitate the development and execution of application programs (e.g., Operating Systems, Compilers, Assemblers, Loaders, Linkers).
Life Cycle of a Source Program
+---------------------+
| Source Code (.c/.asm)|
+----------+----------+
|
v
+---------------------+
| Translator/Compiler | ---> Scans tokens, builds IR, reports syntax errors
+----------+----------+
|
v
+---------------------+
| Object Module (.obj)| ---> Contains machine code with relocation & external tables
+----------+----------+
|
v
+---------------------+
| Linker / Loader | ---> Resolves external symbols, merges modules & loads to RAM
+----------+----------+
|
v
+---------------------+
| Executable Process | ---> Executed by CPU in physical/virtual memory
+---------------------+- Creation / Editing: Developer writes human-readable source code using an editor.
- Translation (Compilation / Assembly):
- The translator scans lexical tokens, validates syntactic and semantic correctness, and translates high-level constructs into an object module.
- Linking:
- Combines independently compiled object files with runtime library routines.
- Resolves cross-module references (external symbols) and produces a unified load module.
- Loading:
- The loader brings the executable program into primary memory, adjusts relocation addresses to physical memory offsets, and prepares the runtime stack and heap.
- Execution:
- The CPU executes machine instructions sequentially, handling I/O and terminating with exit status.