Pennington— The Name in Software Engineering Automation

XTRAN Demonstration:  Produce Module/Procedure Cross-Reference of PL/I

The following analysis used an XTRAN rules file comprising just over 300 lines of "meta-code" (XTRAN's rules language) to analyze all declarations of, and calls to, PROCEDUREs in PL/I.  The XTRAN rules file itself is not specific to PL/I; it is language-independent, and can be used to analyze any language that allows declaration of, and calls to, procedures or functions.

Note that the analysis identified a recursive call at line 12 of the file deman1.pli, even though it was to an outer procedure.

The input to and output from XTRAN are untouched, except for the addition of line numbers to the input files for reference.



* Input to XTRAN:

File deman1.pli:

 1 proc2:PROCEDURE EXTERNAL;  /*external PROCEDURE decl*/
 2         END proc2;
 3
 4 proc3:PROCEDURE EXTERNAL;  /*external PROCEDURE decl*/
 5         END proc3;
 6
 7 proc1:PROCEDURE;           /*PROCEDURE decl*/
 8 proc4:    PROCEDURE;       /*nested PROCEDURE decl*/
 9             CALL proc2;
10             CALL proc4;    /*recursive call*/
11             CALL proc3;
12             CALL proc1;    /*recursive call to outer routine*/
13             CALL proc2;
14             END proc4;
15         CALL proc2;
16         CALL proc3;
17         CALL proc1;        /*recursive call*/
18         CALL proc3;
19         END proc1;

File deman2.pli:

 1 proc3:PROCEDURE EXTERNAL;  /*external PROCEDURE decl*/
 2         END proc3;
 3
 4 proc2:PROCEDURE;           /*PROCEDURE decl*/
 5         CALL proc3;
 6         CALL proc3;
 7         CALL proc3;
 8         CALL proc3;
 9         CALL proc3;
10         CALL proc3;
11         CALL proc3;
12         CALL proc3;
13         CALL proc3;
14         CALL proc3;
15         CALL proc2;        /*recursive call*/
16         CALL proc3;
17         CALL proc3;
18         CALL proc3;
19         CALL proc3;
20         CALL proc3;
21         CALL proc3;
22         CALL proc3;
23         CALL proc3;
24         CALL proc3;
25         CALL proc3;
26         END proc2;


* Output from XTRAN:

               PROCEDURE/Function Cross-Reference

Legend:
       D    => declaration
       X    => external declaration
       N    => nested declaration
       R    => recursive call
       else => call

Declarations & calls for each procedure/function, by source file:

proc1()
       deman1.pli. . . . . . . . . . . . . . . . . . . . 7D, 12R, 17R
proc2()
       deman1.pli. . . . . . . . . . . . . . . . . . . . 1X, 9, 13, 15
       deman2.pli. . . . . . . . . . . . . . . . . . . . 4D, 15R
proc3()
       deman1.pli. . . . . . . . . . . . . . . . . . . . 4X, 11,16, 18
       deman2.pli. . . . . . . . . . . . . . . . . . . . 1X, 5, 6, 7, 8, 9,
                                                         10, 11, 12, 13, 14,
                                                         16, 17, 18, 19, 20,
                                                         21, 22, 23, 24, 25
proc4()
       deman1.pli. . . . . . . . . . . . . . . . . . . . 8DN, 10R

Procedure/function declarations & calls in each source file, by
  procedure/function name:

deman1.pli
       proc1() . . . 7D, 12R, 17R
       proc2() . . . 1X, 9, 13, 15
       proc3() . . . 4X, 11, 16, 18
       proc4() . . . 8DN, 10R
deman2.pli
       proc2() . . . 4D, 15R
       proc3() . . . 1X, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19,
                     20, 21, 22, 23, 24, 25


COPYRIGHT 2012; reproduction prohibited without permission.  Revised 2009-09-11

XTRAN is a trademark of Pennington Systems Incorporated.

  Pennington Systems Incorporated
2820 N. Pinal Avenue, Suite 12
Casa Grande, Arizona 85122-7927
USA


  Phone:  +1(480)626-5503
Fax:  +1(480)626-7618
Email:  Info@Pennington.com
Web:  http://WWW.Pennington.com