Sie sind auf Seite 1von 42

Introduction of Course

Unit 1 :- Introduction Unit 2 :- Assembler Unit 3 :- Loader And Linker Unit 4 :- Macros And Macro Processors Unit 5 :- Scanning And Parsing Unit 6 :- Compiler And Interpreter

About books
Textbook: Dhamdhere System Programming & Operrating System Aho,Ulman,Sethi, Compiler Construction

Reference Books: John J. Donovan System Programming .

This course introduce the basic working principles of software and system administration.

Software
Application programs Word Processors, Email, Internet Browsers, Games Systems Software Compilers, Operating System

Hardware
CPU Memory I/O devices (mouse, keyboard, display, disks, networks, ..)

Application Programming e.g. Accounting S/w, Payroll S/w

System Programming e.g. Assembler Compiler O.S

Application programming is the design, coding, and testing of processes it provide useful function to individuals and/or business and the processes are not related to the hardware they run on. Examples: Calendar program, spreadsheet program, game, checkbook program.

System Programming is the design, coding, and testing of processes that provide direct or indirect (through the operating system) control over the hardware utilized. Examples: device drivers, operating system interfaces (GUI), logon profiles, utility programs.

System Programming:-

Software

Application Software

System Software

Note :- The major goal of any system software is to provide the environment to write application software without which art application software cannot be executed.

Software Classification

Application Software
Application software is defined as a set of programs written in a specific any programming language to solve a particular problem. It is intended to support the operation and it is independent of the machine on which it is Operated. Eg. Accounting Software, Payroll System etc.

System Software
System software is defined as a set of Programs that creates the environment to facilitate working of an application software. Unlike application software, a system software purely depends on the machine on which it is operated.
E.g. Compilers, Assemblers, Operating System.

Need for system software System software controls some of the aspects of operation of a computer. The operation may be a File operation, I/O operation or Memory management and so on.

Translator :- Translator is the program that takes input program written in one language (source program) and output an program in another language (called as object or target program)

Source Program

Translator

Target Program

Machine on which the translator is executed

The various types of system software include


Assemblers Loader Linker Macro Processor Compilers Operating Systems Text Editor Interactive Debugging System (Debugger) Interpreter Program Generator

Assembler is a utility to convert assembly language program to machine code.

Loading is the process of bringing an executable file produced by the linker from the secondary storage to the primary storage in such a way that it can be executed by the operating system.

Assembly Language with Macro Definition

Assembly Language Program

A macro processor is a program that copies a stream of text from one place to another Making a systematic set of replacements as it does so. Macro processors are often embedded in other programs, such as assemblers and compilers.

A compiler is a system software that converts a source language program into an equivalent target language program. It also validates the input program to be conforming to the source language specification. A compiler can be conceptually divided into a number of phases.
Lexical analysis. Syntax analysis. Intermediate code generation Target code generation Code optimization. Symbol table management. Error handling and recovery.

Editor is the utility used most by the program developers. The user creates the program using editor.
The tools that we have described so far help in writing grammatically correct programs. satisfying syntactic and semantic requirements of a language. However, these tools cannot catch any logical mistakes in the program.

Data

Source Program

Interpreter

Target Program

Machine

Application Software
It is concerned mainly with the solution of the problem and makes use of the computer as a software tool. The focus is on the application and not on the computer system. It does not depend on the structure of the machine on which it works. E.g. Banking System, Inventory System

System Software
It is intended to support the operation and makes use of the computer system. The focus is on the computer system and not on the application. It depends on the structure of the machine on which it is executed. E.g. Operating System. Compilers

Language Processors activities arise due to the differences between


The manner in which a software designer describes the ideas concerning the behavior of a soft-ware and The manner in which these ideas are implemented in a computer system.

The designer expresses the ideas in terms related to the application domain of the software. To implement these ideas, their description has to be interpreted in terms related to the execution domain of the computer system.

We use the term semantics to represent the rules of meaning of a domain, and the term semantic gap to represent the difference between the semantics of two domains. Semantic Gap

Application Domain

Execution Domain

A language processor is a software which bridges a specification or execution gap. Semantic gap :-The semantic gap has many consequences
Large development times Large development efforts Poor quality of software.

These issues are tackled by Software engineering through the use of methodologies and programming languages (PL) . Semantic Gap Execution Gap

Application Domain

PL Domain

Execution Domain

Define the terms specification gap and execution gap


Specification gap is the semantic gap between two specifications of the same task. Execution gap is the gap between the semantics of programs (that perform the same task) written in different programming languages.

The languages in which these programs are written are called source language and target language, respectively.

Language Processors = Analysis of SP + Synthesis of TP

Analysis of source statement consists of lexical, syntax and semantic analysis. Synthesis phase consists of two main activities.
Creation of data structures in the target program. Generation of target code.

The phases of language processor.. Language processor consists of two phases.


Analysis phase Synthesis phase
Language processor

SP
Analysis Phase Synthesis Phase

TP

Errors

Errors

It is the processing of every statement in a source program or its equivalent representation to perform a language processing function.
Intermediate representation :- It is a data structure that is
constructed from input data to a program and from which part or all of the output data of the program is constructed in turn. Block Diagram of IR

The compiler takes a source program written in high level language as an input Then converts it into a target assembly language. The assembler then takes this assembly code as input and produces a reloadable machine code as output. Then a program called loader is called for performing the task of loading and link editing. The task of loader is to perform the relocation of an object code.

Relocation of an object code means allocation of load time addresses which exist in the memory and placement of load time addresses and data in memory at proper locations. The link editor links the object modules and prepares a single module from several files of reloadable object modules to resolve the mutual references. These files may be library files and these library files may be referred by any program.

Creating a compiler is a critical task. Hence we can automate the process of building compiler by using automated tools for generating various phases of compiler. LEX and YACC are such tools.
The LEX is used for generating the lexical analyzer program for the compiler. YACC is used to generate the syntax analyzer program automatically. LEX or YACC generates a lexical analyzer or syntax analyzer respectively

Thus the use of LEX and YACC tools help in generating the lexical and syntax analyzers which ultimately enhances efficiency of compiler building.

Example 1.1: Figure 1.2 shows two language processors. The language processor of part (a) converts a C++ program into a C program, hence it is a preprocessor. The language processor of part (b) is a language translator for C++ since it produces a machine language program. In both cases the source program is in C++. The target programs are the C program and the machine language program, respectively.

The fundamental language processing activities can be divided into those that bridge the specification gap and those that bridge the execution gap. We name these activities as 1. Program generation activities 2. Program execution activities. A program generation activity aims at automatic generation of a program. The source language is a specification language of an application domain and the target language is typically a procedure oriented PL. A program execution activity organizes this execution of a program written in a PL on a computer system. Its source language could be a procedure oriented language or a problem oriented language.

Das könnte Ihnen auch gefallen