Compiler-Design Lab Assignment Solution

March 25, 2017 | Author: Kapil Panwar | Category: N/A
Share Embed Donate


Short Description

Download Compiler-Design Lab Assignment Solution...

Description

www.rishabhdua.com DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF EXPERIMENTS COURSE: B.Tech SEMESTER: V SESSION: 2009-10 BRANCH: CSE SUBJECT CODE & NAME: TCS- 502, Compiler Design LIST OF EXPERIMENTS 1 2 3 4 5

6

Write a program to check the identifier in the given source program Write a program to convert an Expression form Infix to Postfix Write a program to find the FIRST of the given grammar Write a program FOLLOW of the given grammar Write a program to implement the parser PREDICTIVE PARSER Write a program to implement the parser SHIFT REDUCE PARSER Implement the following expressions into quadruples

7

8

9 10

a+b+c*d/e+f Implement Constant Folding technique of code optimization Implement Common Subexpression Elimination technique of code optimization Implement Strength Reduction using Induction Variable technique of code optimization

www.rishabhdua.com

www.rishabhdua.com Experiment - 1 Program Name : Write a program to check the identifier in the given source program

Theory Concepts :To identify identifier lexeme in the source program

Flow Chart (If Required) : Implementation : Program to check the identifier in the given source program #include #include #include void main() { char a[10],b[10]; int i,j,p,flag=0; a[]={"if","else","main","void","char","float","goto","for","includ e","int"}; clrscr(); gets(b); for(i=0;i
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF