
*************************************************************
** Parse Tree: Upto the the levels of simple statements   ***
*************************************************************

Program
|  
|  FUNCTION_DEFINITION_HEADER:<compound-stmt>
|  [0] function isPrime ( x ) 
|  
|  |  
|  |  BEGINNING of FUNCTION DEFINITION:<compound-stmt>
|  |  [1] { 
|  |  
|  |  |  
|  |  |  IF_HEADER:<compound-stmt>
|  |  |  [2] if ( x < 2 ) 
|  |  |  
|  |  |  |  
|  |  |  |  RETURN_STATEMENT:<simple-stmt>
|  |  |  |  [3] return 0 ; 
|  |  |  |  
|  |  |  
|  |  |  ASSIGNMENT_STATEMENT:<simple-stmt>
|  |  |  [4] candidate = 2 ; 
|  |  |  
|  |  |  
|  |  |  WHILE_HEADER:<compound-stmt>
|  |  |  [5] while ( candidate < x ) 
|  |  |  
|  |  |  |  
|  |  |  |  BEGINNING of WHILE_BLOCK:<compound-stmt>
|  |  |  |  [6] { 
|  |  |  |  
|  |  |  |  |  
|  |  |  |  |  IF_HEADER:<compound-stmt>
|  |  |  |  |  [7] if ( ( x % candidate ) == 0 ) 
|  |  |  |  |  
|  |  |  |  |  |  
|  |  |  |  |  |  RETURN_STATEMENT:<simple-stmt>
|  |  |  |  |  |  [8] return 0 ; 
|  |  |  |  |  |  
|  |  |  |  |  
|  |  |  |  |  ASSIGNMENT_STATEMENT:<simple-stmt>
|  |  |  |  |  [9] candidate = candidate + 1 ; 
|  |  |  |  |  
|  |  |  |  
|  |  |  |  END of WHILE_BLOCK:<compound-stmt>
|  |  |  |  [10] } 
|  |  |  |  
|  |  |  
|  |  |  RETURN_STATEMENT:<simple-stmt>
|  |  |  [11] return 1 ; 
|  |  |  
|  |  
|  |  END of FUNCTION DEFINITION:<compound-stmt>
|  |  [12] } 
|  |  
|  
|  FUNCTION_DEFINITION_HEADER:<compound-stmt>
|  [13] function allPrimesLessThan ( y ) 
|  
|  |  
|  |  BEGINNING of FUNCTION DEFINITION:<compound-stmt>
|  |  [14] { 
|  |  
|  |  |  
|  |  |  ASSIGNMENT_STATEMENT:<simple-stmt>
|  |  |  [15] num = 2 ; 
|  |  |  
|  |  |  
|  |  |  WHILE_HEADER:<compound-stmt>
|  |  |  [16] while ( num < y ) 
|  |  |  
|  |  |  |  
|  |  |  |  BEGINNING of WHILE_BLOCK:<compound-stmt>
|  |  |  |  [17] { 
|  |  |  |  
|  |  |  |  |  
|  |  |  |  |  FUNCTION_CALL_ASSIGNMENT_STATEMENT:<simple-stmt>
|  |  |  |  |  [18] status = isPrime ( num ) ; 
|  |  |  |  |  
|  |  |  |  |  
|  |  |  |  |  IF_HEADER:<compound-stmt>
|  |  |  |  |  [19] if ( status ) 
|  |  |  |  |  
|  |  |  |  |  |  
|  |  |  |  |  |  DISPLAY_STATEMENT:<simple-stmt>
|  |  |  |  |  |  [20] display num , " is a prime." ; 
|  |  |  |  |  |  
|  |  |  |  |  
|  |  |  |  |  ASSIGNMENT_STATEMENT:<simple-stmt>
|  |  |  |  |  [21] num = num + 1 ; 
|  |  |  |  |  
|  |  |  |  
|  |  |  |  END of WHILE_BLOCK:<compound-stmt>
|  |  |  |  [22] } 
|  |  |  |  
|  |  
|  |  END of FUNCTION DEFINITION:<compound-stmt>
|  |  [23] } 
|  |  



*************************************************************
***                   End of Parse Tree                   ***
*************************************************************
