Metre v2.3

Metre is a freely distributable ANSI/ISO Standard C parser whose behavior is determined by a set of rules. Sets are provided for a metrics tool and a call-tree tool. Written in Standard C, lex, and yacc, it is source-code portable across operating systems, Standard C compilers, and the various flavors of lex and yacc. The documentation includes man pages.

Availability - Metre v2.3 is available on the C-metrics Web page,, via anonymous FTP from the comp.compilers archive,, and from CompuServe in the Software Engineering library [5] of the CASE forum as

Building Tools - Compile the two parser files and one of the rules files with a Standard C compiler and then link their objects together. UNIX and MS-DOS makefiles are included. I provide the parser files that were generated by MKS lex/yacc, but if you want to modify the parser and have a lex/yacc, you can regenerate them. Rules files are provided for a tool that prints call trees, Mtree, and a metrics tool, which is called Metre ("Metre" is the name of the entire package and the metrics tool--it is overloaded). You can modify these rules or write your own.

Metre Metrics Tool - Reports the minimum, maximum, average, and total of the following metrics at the function, module, and project level. Metre also warns about dubious programming practices, such as using the goto statement. This and other behavior can be easily changed, however, by modifying the rules to reflect your own concept of what good programming is.

Mtree Call-Tree Tool - Mtree prints a call graph as an annotated, indented tree of function names. From the command line, you can name the root function, suppress tree lines, select alternate line characters, specify indention and width of file-name margin, and specify whether to print the table of contents and whether to ignore library calls.

Paul Long