Related articles |
---|
Static analysis tools of Pascal: summary Arndt.Jonasson@c3consult.comm.se (1992-03-11) |
Newsgroups: | comp.compilers |
From: | Arndt.Jonasson@c3consult.comm.se (Arndt Jonasson) |
Keywords: | Pascal, tools, summary |
Organization: | Communicator C3Consult AB |
Date: | Wed, 11 Mar 1992 07:49:36 GMT |
In a previous article, I wrote
>I'm looking for information on static analysis tools for Pascal. The
>system of interest is VAX/VMS, but our software doesn't use most of
>the extra features of VAX Pascal.
>
>The tool needs to at least be able to trace variables forward and
>backward, i.e. where is X used, which other variables influence it,
>is it used at all, in this procedure/module/whole program.
and promised a summary. Here it is. Thanks to all who answered.
The VMS environment doesn't seem to have as much public domain software
available as the Unix environment. Possibly it could be that the tools
that DEC supplies are good enough. I haven't used any of these tools
myself, so I don't know.
1) The static analysis tool that is sold by DEC is packaged within a case
platform called DECset, but can also be purchased separately. It seems to
be what most people use. I have put the information I received about it at
the end of this article.
2) If you have the Unix tools yacc and lex (parser generator and lexical
tokenizer), you can write your own Pascal parser/compiler/whatever, using
a public domain syntax description of ISO Pascal level 0, which is
available in archives of mod.sources: Volume 4, Issue 61, and archives of
comp.sources.misc: volume 23.
3) There are a couple of public domain Pascal to C translators, which one
might modify. One of them is written is Pascal itself (though I don't
remember which), so you are not dependent on C.
ptoc: comp.sources.unix, volume10
p2c: comp.sources.unix, volume21
4) iwm@doc.imperial.ac.uk writes:
"I believe that the Berkeley Pascal Compiler that used to be bundled with
BSD Unix does some analysis. It issued warnings about variables that were
used without being set, and set without being used. The sources are
available from archives that have Unix sources on, like uunet or the
server here (src.doc.ic.ac.uk)."
5) wjw@eb.ele.tue.nl (Willem Jan Withagen) writes:
"Most of these research tings are on Unix boxes. I'm currently using the
AWB (Architects WorkBench) from the cs.stanford lab, which has a pascal
compiler and a highlevel-reference tool. I does things like find
basic-blocks, static variables, dynamic-calculated references, and has
oodles of simulators with them. Now I'm not very shure about the who
status of the project. (there working on a release 2.0) The mail address
of the tools should be AWB@umunhum.Stanford.EDU"
6) "Prabal Roy" <roy@reef.cis.ufl.edu> writes:
"We at the Software Engg Research Center at the Univ. of Florida are
working on Static Analysis of C and Pascal programs for the last 2 years.
Our system however runs on Sun-4. For furher info you may request Ms
Tammera Reedy (tcr@reeef.cis.ufl.edu) for the paper Towards an Integrated
Software Maintenance Environment by Livadas, Croll and Roy which appeared
in the Proc of 1st. Symp. on Software Engg. Research Forum, Tampa,
Florida, Nov 1991. We have dealt with most of the Pascal constructs
(except pointers and gotos) including interprocedural dependences. We have
based our work on Weiser "Program slicing", IEEE-TSE July 1984 and
Horwitz, Reps, Binkley "Interprocedural slicing using dependence graphs"
ACM-TOPLAS, Jan 1990. This is part of my master's thesis which will be
completed soon. Hope this helps."
7) There is a British tool called MALPAS, which is what we are current|y
using, and which I was asked to find a replacement for. The problems with
it are apparently the license cost and not-so-good ease-of-use, rather
than functionality, since it does a lot of useful analysis. It handles
Pascal, Fortran, Ada and a few more languages.
======
Here's the information I received about DEC's LSE/SCA tools:
"I recommend that you investigate the LSE (language sensitive editor) and
SCA (source code analyzer) products from Digital Equipment Corporation.
Both of them are packaged together with other programming productivity
tools into a product called DECset, so you may want to look at that as
well (it might save you some money to purchase DECset rather than the
individual products).
With SCA, I can find all occurances of a symbol (identifier, routine,
constant) in any lexical scope that I want: program, module, routine,
block, etc; it can recursively build a call tree as many levels deep as
you want. SCA can even combine the results of a query with another query
to form a third.
This is just a brief example of the kinds of queries that can be formed
with SCA. I've appended some HELP text below to give you a better idea of
how it works. SCA also has a callable interface, so you can write programs
to query SCA's database and customize the information to suit your needs.
SCA is integrated with Digital's compilers today: you simply add the /ANA
qualifier to your PASCAL command line to generate a .ANA file which you
then load into an SCA database.
SCA is also integrated with LSE, Digital's Language Sensitive Editor. You
can query the SCA database within LSE and then use a single keypress
(CTRL/G) to go to the actual spot in the source code where the symbol
occurs! If the query results in multiple occurances, CTRL/F (forward) and
CRTL/B (backward) navigate through the list.
$ help sca
SCA
The VAX Source Code Analyzer is an interactive, multilanguage,
source code cross-reference and static analysis tool that is
designed to aid developers in understanding the complexities of
large-scale software systems.
The DCL command line has the form:
$ SCA [command [/qualifier,...]]
For basic information on using SCA, type "New_Users"; for a listing
of commands, type "Commands"; for tutorial information, type
"Topics".
Additional information available:
CHECK CREATE DELETE EXIT EXTRACT HELP LOAD
REORGANIZE Sca_Example SET SHOW VERIFY VIEW
FIND Commands New_Users Release_Notes Topics
SCA Subtopic? topics query
SCA
Topics
Querying_libraries
1. You can selectively display information about modules in the
current SCA library with the SHOW MODULE command. The
command has the form:
SHOW MODULE [/qualifier...] [module-name-expr[,...]]
Example:
$ SCA SHOW MODULE
Module Ident Compiled
SCA$$DBGETFILE X0.6 3-APR-1985 14:04
SCA$$DBGETFILEOCC X0.6-1 3-APR-1985 14:04
SCA$$DBGETFILESPEC X0.4 3-APR-1985 14:04
Complete (/FULL) or partial (/BRIEF) information about all
(/ALL) modules, or selected (/VISIBLE or /HIDDEN) modules,
can be displayed. The terms "visible" and "hidden" refer to
the results of the module selection process that occur when
multiple libraries are accessed.
2. You can obtain cross-reference information about program
symbols and source files by using the FIND command. The
command has the form:
FIND [/qualifier...] name-expression[,...]
Example:
$ SCA SET LIBRARY SCA$EXAMPLE
%SCA-S-LIB, your SCA Library is
SYS$SYSROOT:[SYSHLP.EXAMPLES.SCA]
$ SCA FIND max*
Symbol Class Module
MAX_CODE constant BUILD_TABLE
BUILD_TABLE CONST
declaration
BUILD_TABLE
BUILD_TABLE
MAX_CODE constant TYPES
TYPES
MAX_RECORD_LEN constant COPY_FILE
COPY_FILE CONST
declaration
COPY_FILE
COPY_FILE
MAX_RECORD_LEN constant TYPES
%SCA-S-OCCURS, 11 occurrences found (4 symbols, 2 names)
Notice that the SCA commands are entered at the DCL level and
all occurrences of symbols that begin with MAX are displayed.
3. You can selectively display call information related to
specified routines in the current SCA library with the VIEW
CALL_TREE command. The command has the form:
VIEW CALL_TREE [/qualifier...] routine-name-expr[,...]
Example:
$ SCA
SCA> VIEW CALL_TREE BUILD_TABLE
BUILD_TABLE
unknown
BUILD_TABLE
%SCA-S-ROUTINES, 3 routines found (no recursive, depth
undetermined)
SCA> EXIT
$
In this example, the library used in the last session is
queried for calls related to the BUILD_TABLE routine.
--
Arndt Jonasson Communicator C3Consult AB
arndt@c3consult.comm.se
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.