Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
Muhammad Fawad Nasim [email protected]
๏ (^) Lexical Analysis: Creates new table entries in the table, example like entries about token. ๏ (^) Syntax Analysis: Adds information regarding attribute type, scope, dimension, line of reference, use, etc in the table. ๏ (^) Semantic Analysis: Uses available information in the table to check for semantics i.e. to verify that expressions and assignments are semantically correct(type checking) and update it accordingly. ๏ (^) Intermediate Code generation: Refers symbol table for knowing how much and what type of run-time is allocated and table helps in adding temporary variable information. ๏ (^) Code Optimization: Uses information present in symbol table for machine dependent optimization. ๏ (^) Target Code generation: Generates code by using address information of identifier present in the table.
๏ Intermediate Code Generation Ties the front and back ends together
๏ A statement of the form x = y op z is a three address statement. ๏ x, y and z are the three operands and op is any logical or arithmetic operator. ๏ Maximum one OP on right side and two operands ๏ Here three address refers to the three addresses in the statement viz addresses of x , y and z.
๏ Say for example we have a statement a = b + c + d Then three address code for this statement is :- t1 = c + d a = b + t t2=a
๏ Only Single operator @ LHS ๏ Say for example we have a statement a = -b + c ๏ Is it in 3 AC?? ๏ No: 2 operators Then three address code for this statement is :- a = -b + c => a = 0 โ b + c t1 = 0 โ b t2= t1+c
๏ Generic Code {to convert it to any language} ๏ Baby feed {Small pieces} ๏ Byte Code(Java)???
If (a < b) t= else t= ๏ (^) For 3AC we need to manually move the control to specific line number 1 2 3 4 How to move the control in assembly??
๏ No loops in 3AC just goto statement!!!!