home *** CD-ROM | disk | FTP | other *** search
-
-
- ADA_METRIC
-
-
- ADA-METRIC is a library of Ada source code useful in building Ada software
- analysis tools. The core of the library, found in files PARSER_4, PARSER_3,
- PARSE_2B, PARSE_2A, PARSER_1 and PARSER_0, is a complete recursive descent
- parser (RDP) for the Ada language. Each part of the Ada language appears as an
- explicit procedure in the source code. For example, the following function
- parses the subtype indicator aspect of the ADA language:
-
-
- -- SUBTYPE_INDICATION ===> NAME [CONSTRAINT ?]
-
- function SUBTYPE_INDICATION return boolean is
- begin
- if (NAME) then -- check for type-mark
- if (CONSTRAINT) then null; end if;
- return (TRUE);
- else
- return (FALSE);
- end if;
- end SUBTYPE_INDICATION;
-
-
- Recursive descent parsing is a top-down method of syntax analysis in
- which a set of recursive procedures processes the input source code. The
- token synbols recognized by the scanner unambigously determine the function
- selected for each nonterminal of the Ada language. ADA-METRIC assumes that
- the source code being analyzed is syntactically correct, that is, that it
- has been successfully compiler by an Ada compiler. Thus parser tasks such
- as type checking are not handled. However the parser can be easily modified
- to perform there tasks.
-
- With the grammar to the Ada language exposed, it becomes easy to develop
- software tools by augmenting those functions and procedures that parse the
- aspects of Ada for which the developed tool will be addressing. For example,
- code provided with ADA-METRIC includes statements to calculate Halstead's
- metric, which measures the quality of Ada programs. These statements, which
- basically count occurences of operators and operands, occur in those parts
- of the parser that parse for operators and operands.
-
- While recursive parsers are less efficient than the state table parsers
- generated by YACC, they have a few advantages. With the grammar explicitly
- laid out in the code, programmers can obtain a much better feel for the
- structure of the Ada language, as compared to the difficult to understand
- YACC state tables. Thus the program is self documenting, as good Ada codes
- should be.
-
- An excellent guide to the Ada language, including the grammar on which
- the parser is based, is found in the ANSI standard ANSI/MIL-STD-1815A-1983.
-
- Included with the source code for the parser are a few Ada packages that
- provide routines for estimating the cost of developing software. The cost
- estimation algorithm has 68 parameters, and is the result of research done by
- NASA to develop formulas for estimating the cost of developing space systems
- software. The structure of the estimator is simple. First there is code to
- query the user for the values of the parameters. These values are then
- substituted into functions whose final results are the cost, time and line of
- code estimates for the project.
-
- Both the recursive descent parser and the cost estimator have very simple
- user interfaces, mostly to provide a feel on how the programs operate. The
- goal of the users of ADA-METRIC should be to embed the main algorithms in
- these packages into their own systems and user interfaces. Also, some of
- the algorithms in ADA-METRIC are optimized to be easy to understand, rather
- than to be efficient in operation (such as the keyword lookup recognizer).
-
- PLATFORMS
-
- The source code on the diskettes provided with this package will
- compile and execute on most personal computers, workstations, minicomputers
- and mainframes, for compilers running under most operating systems,
- including MS-DOS, OS/2, Xenix, Unix, and VMS. There are no royalties on
- embedded use of these libraries.
-
- The source code library is available from STO for $450. Please specify
- your choice of media (floppy disk, electronic mail, cartridge tape).
-
- Our goal at Source Translation & Optimization is to transfer software
- technology into your applications by providing clear and simply coded
- algorithms. You are encouraged to optimize the Ada code to the conventions
- used in your programming environment.
-
- STO also publishes a directory of software available from the US
- government. The 1990 edition includes the titles to over 9000 programs for
- which source code is available. The 320 page directory costs $79.
-