Pennington— The Name in Software Engineering Automation

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

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/M.  The XTRAN rules file itself is not specific to PL/M; 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 8 of the file deman1.plm, 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.plm:

 1 proc2: PROCEDURE EXTERNAL;           /*external func decl*/
 2      END proc2;
 3
 4 proc1: PROCEDURE;
 5
 6      proc1a: PROCEDURE;              /*nested func decl*/
 7          CALL proc1a;                /*recursive call*/
 8          CALL proc1;                 /*2nd-order recursive call*/
 9          CALL proc2;                 /*call to external func*/
10          END proc1a;
11
12      CALL proc1;                     /*recursive call*/
13      CALL proc2;                     /*call to external func*/
14      CALL proc2;                     /*duplicate call*/
15      END proc1;

File deman2.plm:

 1 proc1: PROCEDURE EXTERNAL;           /*external func decl*/
 2      END proc1;
 3
 4 proc3: PROCEDURE EXTERNAL;           /*external func decl*/
 5      END proc3;
 6
 7 proc2: PROCEDURE;
 8      CALL proc1;                     /*call to external func*/
 9      CALL proc2;                     /*recursive call*/
10      CALL proc3;                     /*call to external func*/
11      CALL proc3;                     /*duplicate call*/
12      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.plm. . . . . . . . . . . . 4D, 8R, 12R
    deman2.plm. . . . . . . . . . . . 1X, 8
proc1a()
    deman1.plm. . . . . . . . . . . . 6N, 7R
proc2()
    deman1.plm. . . . . . . . . . . . 1X, 9, 13, 14
    deman2.plm. . . . . . . . . . . . 7D, 9R
proc3()
    deman2.plm. . . . . . . . . . . . 4X, 10, 11

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


deman1.plm
    proc1() . . . 4D, 8R, 12R
    proc1a(). . . 6N, 7R
    proc2() . . . 1X, 9, 13, 14
deman2.plm
    proc1() . . . 1X, 8
    proc2() . . . 7D, 9R
    proc3() . . . 4X, 10, 11


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