Introduction to Language Programming Hierarchy of programming lang. Based on machine independences: 1. Machine language 2. Assembly language 3. Higher level / user oriented language 4. Problem oriented language
Machine level language Each instruction numeric code numerical address memory location in computer’s memory program written in microcode(I.e. microprogram) microcode a set basic machine instruction
Assembly language Simbolic version operation code symbolic code, such ADD, MUL, DIV, PUSH, POP memory location symbolic name, such PAY, RATE offerring certain diagnostic and debugging assistance
High level language Such as FORTRAN, PASCAL, PL/I offering most of features of an assembly language offering a more enriched set of language features, such as structured control construct, nested statements, blocks, and procedures
Problem oriented language Providing for expression of problems in specific app./problem area. Such SQL database app, COGO civil eng. App.
Advantages of high level languages over low level such machine and assembly languages HLL more easier to learn programmer does’nt to concern with clerical tasks involving numerical or symbolic references to intructions, mem location, constants, etc programmer is not required to know how to convert data from external forms to various internal forms within the memory of computer most HLL offer a programmer a variety of control structure, such IF THEN ELSE and CASE statement programs written in HLL is usually more easily debugged
Advantages > Availability of certain features such as procedures better documentation HLL relatively machine independent since most HLL offer more powerful control and data structuring capability the former class of lang. Facilitates the expression of a solution to particular problem
Translator Inputing and then converting a source program into object or target program source program written in a source language and object belongs to object language assembly assembler machine language a time at which the conversion of a source program to an object program occurs compile time
Compilation process
Interpretive process
interpreter interpreter processes an internal form of the source program and data at the same time interpreter does not generate object code such BASIC, LISP, SMALLTALK
Model of a compiler Constructing a compiler very complex a compiler must perform 2 major task: –analysis of source program front end, the tasks deal with decomposition of source prg into its basic parts –synthesis of corresponding object program back end, the tasks generating and optimizing object program components of a compiler: –scanner /lexical analyzer separating the incoming text into pieces or tokens –syntax analyzer/parser checking correct tokens and sequences tokens
> models a compiler Semantic analyzer carrying on semantic analysis, usually connected with intermediate code generator code generator code optimizer table symbol
Figure of model of a compiler