3/21/2018 COMPILER LAB CS6612: data flow analysis in c program
COMPILER LAB CS6612
This blog will contain Lab programs for CS6612 Compiler lab for anna university r2013 CSE 6th Semester Students
Search This Blog
Showing posts with label data flow analysis in c program. Show all posts
Search
Saturday, 13 January 2018
data flow analysis in c program Home
About Me
mohan raj
Follow 14
View my complete profile
Report Abuse Labels
Compiler lab
Ex. No: 7 B data flow
Date: analysis in c
7B. Implement Data flow analysis program
etc.)
AIM: Implementation
of Simple Code
To write a C program to implement Data Flow Analysis. Optimization
Techniques
(Constant
Folding.
INTRODUCTION:
Blog Archive
Data flow analysis is a technique for gathering information about the possible set of
value calculated at various points in a computer program. ▼ 2018 (14)
▼ January (14)
ALGORITHM:
11. Implementation of Simple Code
Optimization Tec...
Step-1: Start the Program Execution.
10. Implement the back end of the
Step-2: Read the total Numbers of Expression compiler which t...
Step-3: Read the Left and Right side of Each Expressions
9. Construction of DAG
Step-4: Display the Expressions with Line No
Step-5: Display the Data flow movement with Particular Expressions 8. Implement any one storage allocation
strategie...
Step-6: Stop the Program Execution.
data flow analysis in c program
7A. Implement control flow analysis
PROGRAM
6. Implement type checking
#include <stdio.h> 5 Convert the BNF rules into Yacc form
and write ...
#include <conio.h>
#include <string.h > 4C Implementation of Calculator using
LEX and YAC...
struct op
{ 4B Program to recognize a valid variable
which st...
char l[20];
char r[20]; 4A PROGRAM TO RECOGNIZE A VALID
ARITHMETIC EXPRES...
}
op[10], pr[10]; 3. Implementation of Lexical Analyzer
using Lex ...
void main() 2. Develop a lexical analyzer to
{ recognize a few p...
int a, i, k, j, n, z = 0, m, q,lineno=1; 1. IMPLEMENTATION OF SYMBOL
char * p, * l; TABLE
char temp, t;
char * tem;char *match;
clrscr();
printf("enter no of values");
scanf("%d", & n);
[Link] 1/3
3/21/2018 COMPILER LAB CS6612: data flow analysis in c program
for (i = 0; i < n; i++)
{
printf("\tleft\t");
scanf("%s",op[i].l);
printf("\tright:\t");
scanf("%s", op[i].r);
}
printf("intermediate Code\n");
for (i = 0; i < n; i++)
{ printf("Line No=%d\n",lineno);
printf("\t\t\t%s=", op[i].l);
printf("%s\n", op[i].r);lineno++;
}
printf("***Data Flow Analysis for the Above Code ***\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
match=strstr(op[j].r,op[i].l);
if(match)
{
printf("\n %s is live at %s \n ", op[i].l,op[j].r);
}
}
}}
OUTPUT:
Enter no of values
4
left a
right: a+b
left b
right: a+c
left c
right: a+b
left d
right: b+c+d
Line No=1
a=a+b
Line No=2
b=a+c
Line No=3
c=a+b
Line No=4
d=b+c+d
***Data Flow Analysis for the Above Code ***
a is live at a+b
a is live at a+c
a is live at a+b
b is live at a+b
b is live at a+b
b is live at b+c+d
c is live at a+c
c is live at b+c+d
d is live at b+c+d
RESULT:
Thus the above program is compiled and executed successfully and output is verified.
at January 13, 2018 No comments:
Labels: data flow analysis in c program
[Link] 2/3
3/21/2018 COMPILER LAB CS6612: data flow analysis in c program
Home Older Posts
Subscribe to: Posts (Atom)
11. Implementation of Simple Code Optimization Techniques (Constant
Folding.,etc.)
Ex. No: 11 Date: 11. Implementation of Simple Code Optimization Techniques (Constant
Folding.,etc.) ...
7A. Implement control flow analysis
Ex. No: 7A Date: 7A. Implement control flow analysis AIM: To write a C program to
implement Control Flow Analysis. ...
data flow analysis in c program
Ex. No: 7 B Date: 7B . Implement Data flow analysis AIM: To write a C program to
implement Data Flow Analysis. ...
8. Implement any one storage allocation strategies STACK
Ex. No: 8 Date: 8 . Implement any one storage allocation strategies(Heap,Stack,Static)
MEMORY IN C – THE STACK, THE HE...
counter
Simple theme. Powered by Blogger.
[Link] 3/3