COMPAILERS Definition A compailer acceepts aprogram writen in a highlevel languages as input and produces its machine language equivalent as output . General model of compailer In analysing the compilation of our simple pl/program w e found distinct logical problems as follows 1. Lexical analsys- recognitio of basic elements and ceratin of uniform symbols 2. Sysnax analysis- recgonition of syntactic constructs through reductions 3.
Implementation-definition of exat meanings creatin of matrix and tables by action routines 4. Machine independent optimization-creation of more optimal matrix 5. Storage assignment- modification of identifier and literal tables. it makes entries in matrix that allow code generation to creat code that allocates dynamic storage,and also allow the assembly phase to reserve the proper amounts of STATIC storsge. 6. Code generation-use of macro processor to produce more optimal assembly langage. . Assembly and output-resolving symbolic addresses(lables)and generating machine language. Databases which are used by the compailer A. Source code- in our example the PL/I program B. Uniform symbol table –consist of full or partial list of the tokens’as they appear in the program. created by lexical analysis and used for syntax analysis and interpretation C. Terminal table- a permanent table which lists all key words and specal symbols of language in symbolic form D.
Need essay sample on "Compailer" ? We will write a custom essay sample specifically for you for only $12.90/page
Identifier table –contans all veriables in the program and temparary storage and any information needed to reference or allocate storage of them ;created by lexical analysis,modified by interpretation and storage allocation,and referenced by code generation and assembly. the table may also cotains information of all temparary locations that the compailer creates for use during execution of the source program E. Literal table-contains all constants in the program creation and use similar to D above. F.
Reductions –permanent table of decision rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure . G. Matrix –intermediate form of program which is creted by the action routines,optimized,and then used for code generation. H. Code productions- permanent table of definitions. there is one entry defining code for each possible matrix operator. I. Assembly code-assembly language version of the program which is created by the code generation phase and id input to the assembly phase J. Relocatable object code –final output of assembly phase,ready to be used as input to the loader