Understanding System Software: Components and Language Processing
Delve into the intricate world of system programming with an overview of system software components and language processing activities such as assemblers, macro processors, and application software development. Explore the role of system software in controlling computer hardware operations and the interactions between application and system software.
Download Presentation
![](/assets/img/so-down.gif)
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
UNIT-1 Introduction to System Programming Introduction: Components of System Software, Language Activities, Fundamentals of Language Processing Assemblers: Elements Language Programming, Assembly Scheme, Pass structure of Assemblers, Design Assembler, Single pass assembler Macro Processor: Macro Definition and call, Macro Expansion, Nested Macro Calls and definition,Advanced Macro Facilities, Design of Macro Processor Processing of Assembly A simple of Two Pass
Unit-1 Introduction: Components of System Software, Language ProcessingActivities, Fundamentals of Language Processing
Unit-1 Basic Software Types of software Application software-Word, Excel etc. System Software- Compiler, Assembler,O.S., Linker etc. Operating and systems software Application software Users Hardware Sytem Programming
Unit-1 Application Software Develop using Programming Lang. and Tools Application software interact with systems software; systems software then directs computer hardware to perform the necessary tasks Sytem Programming
Unit-1 System Software Needed for program development. Controls operations of computer hardware Definition: System Software Consist of a variety of program that support the operation of a computer. Sytem Programming
Language processing Model Source Program C,C++,java etc Compiler Target Assembly Program Assembler Relocatable M/c Code Loader/Link editor Lib+ relocatable obj file Executable M/c Code
Unit-1 Components of System Software, Example: Assembler Compiler Macro processor Loader Linker Interpreter Operating System Debugger Text editor Sytem Programming
Programming Languages: Terminology Language translator Systems software that converts a programmer s source code into its equivalent in machine language Source code High-level program code written by the programmer Object code Another name for machine language code
Unit-1 Assembler A Translator Assembler Assembly Language Program Machine Language format or object file Fig.: Assembler Assembler make two passes over the assembly file First Pass: reads each line and records labels in a symbol table. Second Pass : use info in symbol table to produce actual machine code for each line.
Unit-1 Assembler Assembly lang. a symbolic representation of machine language. uses a mnemonic to represent each low-level machine instruction or operation. Assemblers with different syntax for a particular CPU or instruction set architecture. Example:- An instruction to add memory data to a register x86-family processor: add eax,[ebx], whereas this would be written addl (%ebx),%eax in the AT&T syntax used by the GNU Assembler.
Unit-1 Compiler Once the target program is generated, the user can execute the program. Error Messages Program in Source Language Target code(Program in machine code) Compiler Fig.: A Compiler
Unit-1 Compiler Early compilers were written in assembly language. A compiler verifies code syntax, generates efficient object code, performs run-time organization, and formats the output according to assembler and linker conventions
Unit-1 Macro Processor It allows the programmer to write shorthand version of a program . Macro allows a sequence of source language code to be defined once and then referred to by name each time it is to be referred. Each time this name Occurs in a program, the sequence of codes is substituted at that point.
Unit-1 Copy code -- Example Source STRG . STRG . STRG . . Expanded source . . . . . { MACRO STA STB STX MEND DATA1 DATA2 DATA3 { STA STB STX DATA1 DATA2 DATA3 STA STB STX DATA1 DATA2 DATA3
Unit-1 Loader and Linker A program which accepts object program and prepares them for execution. 4 main functions: Allocationof space in main memory for the programs. Linking of object modules with each other. Adjust all address dependent locations. Physically loading the machine instructions and data into the main memory. i. ii. iii. iv.
Unit-1 Interpreter A Interpreter reads the source code one instruction or line at a this line into machine code or some intermediate form and executes it. Machine language statement Program statement Interpreter Statement execution Fig.: Interpreter
Unit-1 Operating System- Interface between users and the hardware of a computer system. Debugger- helps to detect error in the program. Text editor- used to create and modify the program.
Unit-1 Language Processing Activities It Involves translation of a program written in a high level language into machine code It can be divided into two groups: 1. Program generation activities 2. Program execution activities
Unit-1 Language Processing Activities.. Program generation Language processing activities Using compiler Program execution Using interpreter
Unit-1 1.Program generation activities Error Messages Program specification Program in target PL Program generator Fig.: Program generator The program generator is a software which accepts the specification of program to be generated Andgenerates a program in target programming lang. Sytem Programming
Unit-1 1.Program generation activities Fig.: Specification and Execution gap Execution gap is bridged by the compiler or interpreter. The program generator bridges the gap between application domain & Programming lang. (PL)domain Sytem Programming
Unit-1 1.Program generation activities Example- A Screen handling Program. Employee name: Address: Married: Age Sex Sytem Programming
Unit-1 2.Program Execution activities 2 Models for Program Execution: 1.Translation 2.Interpretion A program must be translated before it can be executed. The translated program may be saved in a file.The saved program may be executed repeatedly.
Unit-1 1.Program Translation Fig.: Program Translation Model Sytem Programming
Unit-1 Program Interpretation Sytem Programming
Unit-1 Fundamental of Language Processing Language Processing=Analysis of SP + Synthesis of TP Fig.: Phases of language of language processing Sp=source prog. TP=target program System Programming
Unit-1 Analysis Phase Three components: 1. Lexical rules -the formation of valid lexical units in the source language. Example:percent_profit = (profit * 100) / cost_price; identifies =, * and / operators, 100 as constant, and the remaining strings as identifiers. 2. Syntax rules the formation of valid statements in the source language. Example : percent_profit as the left hand side and (profit * 100) / cost_price as the expression on the right hand side. System Programming
Unit-1 Analysis Phase 3. Semantic rules -associate meaning with valid statements of the language. example: percent_profit = (profit * 100) / cost_price; Semantic analysis : assignment of profit X 100 / cost_price to percent_profit Sytem Programming
Unit-1 Synthesis Phase It performs two main activities: 1. Creation of data structures in the target program (memory allocation) 2. Generation of target code (code generation) Example MOVER AREG, PROFIT MULT AREG, 100 DIV AREG, COST_PRICE MOVEM AREG, PERCENT_PROFIT PERCENT_PROFIT DW 1 PROFIT DW 1 COST_PRICE DW 1 Sytem Programming
Unit-1 Assemblers: Elements of Assembly Language Programming, A simple Assembly Scheme, Pass structure of Assemblers, Design of Two Pass Assembler, Single pass assembler
Unit-1 Assembler A Translator Assembler Assembly Language Program Machine Language format or object file Fig.: Assembler Assembler make two passes over the assembly file First Pass: reads each line and records labels in a symbol table. Second Pass : use info in symbol table to produce actual machine code for each line.
Unit-1 Assembler The translated program contains 3 kinds of entities: 1. Relative entities- address of instructions and variables. 2. Absolute entities- operation code , numeric and string constant and fixed addresses. 3. The object program- addresses are relative symbols are defined externally Sytem Programming
Unit-1 Assembler Assembly lang. a symbolic representation of machine language. uses a mnemonic to represent each low-level machine instruction or operation. Assemblers with different syntax for a particular CPU or instruction set architecture. Example:- An instruction to add memory data to a register x86-family processor: add eax,[ebx], whereas this would be written addl (%ebx),%eax in the AT&T syntax used by the GNU Assembler.
Unit-1 Assembler Elements of assembly language programs: A. Basic features B. Statement format C. Operation code Sytem Programming
Unit-1 A.Basic features Assembly lang. Provides 3 basic features: 1. Mnemonic Operation Codes(Opcodes) Ex: MOVER or MOVEM 2. Symbolic Operand: Ex: DS Declare as storage DC Declare as Constant 3. Data Declaration: Ex: X DC -10.5 Sytem Programming
Unit-1 B.Statement Format Statement Format: [Label] <opcode> <operand1> [ <operand2>..] Label-Optional Opcode-it contain symbolic operation code Operand- Operand can also be a CPU register: AREG, BREG,CREG. Example- LOOP : MOVER AREG, =5
Unit-1 Machine Instruction Format Memory operand(3) Sign Reg.operand(1) Opcode(2) Fig.: Machine Instruction format for assembly lang. Sign is not part of the instruction Reg.operand: AREG, BREG,CREG,DREG. Memory operand: Refers memory word using symbolic name Sytem Programming
Unit-1 Machine supports 11 Different Operations Symbolic opcode STOP ADD SUB MULT MOVER MOVEM COMP Remark Stop Excecution Operand Oper1+Oper2 Operand Oper1- Oper2 Operand Oper1*Oper2 CPU Register Memory move Memory operand CPU register Set condition code Comparison instruction sets a condition code The condition code can be tested by BC Branch on condition Format for BC : BC <condition code spec.>, <Memory address> 1. LT-Less than 2. LE-Less or equal 3. EQ-Equal 4. GT-Greater than 5. GE-Greater or equal 6. ANY-Implies unconditional transfer of control BC
Unit-1 Machine supports 11 Different Operations Symbolic opcode Remark Operand Oper1/Oper2 DIV Operand2 input value READ Output operand2 PRINT First operand is always a CPU register Second operand is always a memory operand
Unit-1 Assembly language statements 3 types of Statement in Assembly Language 1. Imperative 2. Declaration 3. Assembler directives
Unit-1 1.Imperative Statement Executable statement Indicates an action to be taken. translates into a machine instruction. class IS Ex.: 1. MOVER BREG, X 2. STOP 3. READ X 4. PRINT Y 5. BC NE,L1
Unit-1 2.Declaration statements Reserves memory for variables Initial value of a variable can also be specified. [label] DS <const specifying size of memory to be reserved> [label] DC <Initial value of variable> DS declare storage, DC declare constant Class-DL >
Unit-1 2.Declaration statements Reserve memory area of 1 word for variable X X DS Y DS 5 1
Unit-1 2.Declaration Statements ONE DC 1 Reserve one word of memory for variable ONE Memory is initialized with 1
Unit-1 MOT for declaration statements Mnemonic opcode Class Opcode DS DL 01 DC DL 02
Unit-1 3.Assembler Directive Instructs the assembler to perform certain actions during assembly of a program. A directive is a direction for the assembler A directive is also known as pseudo instruction machine code is not generated for AD.
Unit-1 3.Assembler Directive START <Constant> It indicates that the first word of the m/c code should be placed in the memory word with the address <CONSTANT>
Unit-1 3.Assembler Directive END [<OPERAND SPECIFICATION>] Optional, indicates address of the instruction where the address of program should begin. By default, execution begins from the first instruction. It indicates the end of the source program. Class:AD
Advanced Assembler Directives These directive include: 1. ORIGIN 2. Symbol 3. LTORG
ORIGIN Useful when m/c code is not stored in consecutive memory location. ORIGIN <address specification> Operand or constant or expression containing an operand and a constant. Sets LC to the address given by <address specification> LC processing in a relative rather than absolute manner