Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.

Similar presentations


Presentation on theme: "1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY."— Presentation transcript:

1 1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY

2 2 Topics covered ahead System software and its types Compiler And its Phases

3 3 System software refers to the files and programs that make up your computer's operating system. System files include libraries of functions, system services, drivers for printers and other hardware, system preferences, and other configuration files. The programs that are part of the system software include assemblers, compilers, file management tools, system utilites, and debuggers. System software

4 4 Types of system software Complier Assembler Loader Linker Operating system

5 5 A compiler translates the code written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target code efficient and optimized in terms of time and space. Compiler design principles provide an in-depth view of translation and optimization process. Compiler design covers basic translation mechanism and error detection & recovery. It includes lexical, syntax, and semantic analysis as front end, and code generation and optimization as back-end. Compiler

6 6 Assembler An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.

7 7 In computer science, a linker is a computer program that takes one or more object files generated by a compiler and combines them into one, executable program. Computer programs are usually made up of multiple modules that span separate object files, each being a compiled computer program. The program as a whole refers to these separately-compiled object files using symbols. The linker combines these separate files into a single, unified program; resolving the symbolic references as it goes along. Linker

8 8 What is an operating system? An operating system (sometimes abbreviated as "OS") is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer. The other programs are called applications or application programs. The application programs make use of the operating system by making requests for services through a defined application program interface (API). In addition, users can interact directly with the operating system through a user interface such as a command language or a graphical user interface (GUI). Operating system

9 In a computer operating system, a loader is a component that locates a given program (which can be an application or, in some cases, part of the operating system itself) in offline storage (such as a hard disk), loads it into main storage (in a personal computer, it's called random access memory ), and gives that program control of the computer (allows it to execute its instructions). loader

10 10  Create a new address space for the program  Copies instructions and data into address space  Copies arguments passed to the program on the stack  Initializes the machine registers including the stack  Jumps to a startup routine that copies the program Steps

11 What is a compiler? A program that reads a program written in one language (source language) and translates it into an equivalent program in another language (target language). Two components Understand the program (make sure it is correct) Rewrite the program in the target language. Traditionally, the source language is a high level language and the target language is a level language (machine code). 11 compiler Source program Target program Error message

12 Source program with macros Preprocessor Source program Compiler Target assembly program assembler Relocatable machine code linker Absolute machine code 12

13 Compilation Phases and Passes Compilation of a program proceeds through a fixed series of phases Each phase use an (intermediate) form of the program produced by an earlier phase Subsequent phases operate on lower-level code representations Each phase may consist of a number of passes over the program representation Pascal, FORTRAN, C languages designed for one-pass compilation, which explains the need for function prototypes Single-pass compilers need less memory to operate Java and ADA are multi-pass 13

14 14 Scanner: Lexical Analysis The lexical phase reads the characters in the source program and groups them into a stream of tokens in which each token represents a logically cohesive sequence of characters, such as, An identifier, A keyword, A punctuation character. – The character sequence forming a token is called the lexeme for the token.

15 Parser: Syntax Analysis Checks whether the token stream meets the grammatical specification of the language and generates the syntax tree. A syntax error is produced by the compiler when the program does not meet the grammatical specification. For grammatically correct program, this phase generates an internal representation that is easy to manipulate in later phases Typically a syntax tree (also called a parse tree). 15

16 Semantic Analysis Semantic analysis is applied by a compiler to discover the meaning of a program by analyzing its parse tree or abstract syntax tree. This phase checks the source program for semantic errors and gathers type information for the subsequent code-generation phase. – It uses the hierarchical structure determined by the syntax-analysis phase to identify the operators and operands of expressions and statements. – An important component of semantic analysis is type checking. 16

17 17 Code Generation and Intermediate Code Forms The syntax and semantic analysis generate a explicit intermediate representation of the source program. – The intermediate representation should have two important properties: It should be easy to produce, And easy to translate into target program. – Intermediate representation can have a variety of forms. – One of the forms is: three address code; which is like the assembly language for a machine in which every location can act like a register. – Three address code consists of a sequence of instructions, each of which has at most three operands.

18 18 Code optimization phase attempts to improve the intermediate code, so that faster- running machine code will result. Code Optimization: – The final phase of the compiler is the generation of target code, consisting normally of relocatable machine code or assembly code. – Memory locations are selected for each of the variables used by the program. – Then, the each intermediate instruction is translated into a sequence of machine instructions that perform the same task. Code Generation:


Download ppt "1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY."

Similar presentations


Ads by Google