Вы находитесь на странице: 1из 34

System Software

The subject introduced the design and implementation of system software

System software consists of a variety of programs that support the operation of a computer
operating system, compiler, assembler, macro processor, loader or linker, debugger, text editor, database management systems, software engineering tools, .

We Discussed On
Machine Architecture Assemblers Loaders and Linkers Editors and Debugging Systems Macro Processor Compilers Lex and Yacc

Machine Architecture

This Chapter Gave you

System Software & Machine Architecture The Simplified Instructional Computer SIC and SIC/XE Traditional (CISC) Machines Complex Instruction Set Computers RISC Machines Reduced Instruction Set Computers

SIC Machine Architecture Memory and Registers

Data Formats Instruction Formats Addressing Modes Instruction Set Input and Output

Space for 2 inch x 2 inch size Picture

Memory and Registers Data Formats Instruction Formats Addressing Modes Instruction Set Input and Output

SIC/XE Machine Architecture

Traditional (CISC) Machines

Complex Instruction Set Computers Has relatively large and complex instruction set Different instruction formats, different lengths, different addressing modes Implementation of hardware is complex VAX and Intel x86 processors are examples

RISC Machines
Reduced Instruction Set Computers Intended to simplify the design of processors. Greater reliability, faster execution and less expensive processors Standard and fixed instruction length Number of machine instructions, instruction formats, and addressing modes relatively small


This Chapter Gave you

-Assembler Definition - Assembler Features - Machine dependent and machine independent features - Design of various assemblers - One-pass - Multi-pass

Translating source code written in assembly language to object code. Assigning machine address to symbolic labels.

Assembler Design
Assembler Design can be done in:
Single pass Two pass

Single Pass Assembler:

Does everything in single pass Cannot resolve the forward referencing

Multi pass assembler:

Does the work in two pass Resolves the forward references

First pass:
Scans the code Validates the tokens Creates a symbol table

Second Pass:
Solves forward references Converts the code to the machine code

Machine-Dependent Assembler Features

In Machine Specific Instructions we have:
Instruction Format and Addressing modes How to handle program relocation

Machine independent features Literals Symbol defining statements Expressions Program blocks Control Sections and program linkings

Types of Assemblers
One-pass assembler Multi-pass assembler Two-pass assembler with overlay

Role of Loader
Source Program Translator Object Program Loader
Object program ready for execution

Translator Assembler/Compiler

Role of Loader
Source Program Assembler Object Program Loader
Object program ready for execution


Role of Loader and Linker


Source Program Assembler

Object Program

Object program ready for execution

Executable Code Loader

Role of Absolute Loader

Object Program Absolute Loader
1000 Object program ready for execution



Machine-Dependent Loader Features

Absolute Loader Simple and efficient Disadvantage is programmer has to specify the starting address One program to run no problem not for several Difficult to use subroutine libraries efficiently

Linking Loaders

Object Program(s)


Linking loader


Processing of an Object program using LL

The source program is first assembled or compiled, producing an object program. A linking loader performs all linking and loading operations, and loads the program into memory for execution

Linkage Editors

Object Program(s)

Linkage editor

Linked program Relocating loader

Processing of an Object program using LE


Implementation examples
Brief description of loaders and linkers for actual computers They are MS-DOS Linker SunOS Linkers - Pentium architecture - SPARC architecture

Cray MPP Linkers T3E architecture

A macro instruction (Macro) is a notational convenience for the programmer Allows the programmer to write short hand programs (modular programming). The macro processor replaces each macro instruction with its equivalent block of instructions. The macro processor is not concerned with the meaning of the involved statements during expansion. The design of the macro processor is generally machine independent.

Macro Expansion Macro Invocation Two-Pass Macro Processor

Design of two-pass macro processor
Pass 1:
Process all macro definitions

Pass 2:
Expand all macro invocation statements

One-Pass Macro Processor

A one-pass macro processor that alternate between macro definition and macro expansion in a recursive way is able to handle recursive macro definition
Data Structure for One-Pass Macro Processor - DEFTAB (definition table) - NAMTAB - ARGTAB

-Machine-Independent Macro Processor Features -Concatenation of Macro Parameters -Generating Unique Labels -Macro-time Looping -Conditional Macro expansion -Keyword macro parameters -Recursive Macros -Line-by-Line Macros -Integrated Macros


Introduction Basic Compiler Function Lexical Analysis, Syntactic Analysis Operator-Precedence Parsing Shift Reduce Parsing Recusive Descent Parsing

Source Program

Phases of Compilers
Table Management

Lexical analysis Syntax analysis Intermediate Code generation Code Optimization Code Generation Target Program Error Handling

Code Generation Machine - Dependent Code Optimization Machine Independent Compiler Features Machine - Independent Code Optimization


There are several different possibilities for performing machine-dependent code optimization . Assignment and use of registers Divide the problem into basic blocks.

Rearrangement of machine instruction to improve efficiency of execution

Machine Independent Compiler Features Storage Allocation Block Structured Languages Compiler Design Options Division Into Passes Interpreters P-Code Compilers Compiler-Compilers

Lex and Yacc

-LEX is a program generator designed for lexical processing of character input streams. -Yacc provides a general tool for describing the input to a computer program

LEX (LEXical Analyzer Generator) Features

Creating a Lexical Analyzer with LEX LEX Source LEX Regular Expressions Functions

YACC Yet Another Compiler-Compiler YACC Basic Specification How does the Parser Works? Ambiguity and Conflicts YACC Programs simple expression with +, - , /, and *. recognize an valid variable. Lex and Yacc