Hobby     Humor   Guest Book   Contact us  

 
 
                                Home   Research  Projects   Resume   My School

Abstract           Introduction          Our Approach            Kiviat diagram          Conclusions

Software Quality

Control flow graph 

The purpose of this method is to generate a control flow graph for the given input program.  The input to this module comes from the lexical analyzer. 

The control flow graph ( CFG) shows the major transforms the software will have and how the control will flow between the transforms. 

A control flow graph for procedure p contains a node for each simple or conditional statement in p; edges between nodes represent the flow of control between statements. The statements nodes will be shown as ellipses, which represent simple statements.  Predicate nodes to be shown as rectangles, stand for conditional statements. Labeled edges (branches) leaving predicate nodes represent control paths taken when the predicate evaluates to the value of the edge label. Statement and predicate are labeled the statements in p to which they correspond. Case statements can be represented in CFG's as nested if-else statements; in this case, every CFG node has either one unlabelled out edge or two out edges.  

Declarations and the non-executable initilization statements can be represented collectively as a single node, associated with this node in the order they are encountered by the compiler. A unique entry node and a unique exit node represent entry to and exit from p, respectively. The CFG for a procedure p has size and can be constructed in time, linear in the number of simple and conditional statements in p.

 

Problem specification

The data flow diagram for this module is shown in the figure

   

 

Data definitions 

The major data structure used in the CFG are  

  1. filename.dat

is the input file which of the format

1            0            #            include             <            stdio            .            h            >
2            0            main            (            )
3            0            {
4            0            int             I            ,            j            ,            k            ;
5                        if             (            I            <            j            )            ;
6            0            ------
7            0            }

  1. token: is a structure which is defined in the lexical analyzer
  2. node1 is a structure with
    1. No is of integer type which denotes statement number
    2. link is a pointer to node1 structure.
  3. Node is a structure with
    1. No is of integer type which denotes statement number
    2. Next its value is 1 if there is path form this node number to next statement number
    3. link is a pointer to node 1 structure

 

Functions 

CFG

Input -> pointer to the token structure.

Output -> filename.cfg which contains control flow graph of filename.c

Purpose -> it generates the control flow graph of the given program. 

Control:

Input -> pointer to the token strucure

Output -> it nodeifies the control flow graph

Purpose -> is to handle the flow graph of control statements, whose status is 1.

 

Assumptions

            The program must not contain switch-case, do-while statements.

bstract          Introduction          Our Approach            Kiviat diagram      Conclusions