

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The purpose of this project is to build a program using a set of C++ modules that examine and record in an XML file the results of analyzing one or more source code files. Specifically, you will analyze each file matching a pattern supplied on the command line and display to the user, and record in an XML file, the following: Correct header preprocessor statements (yes or no) Prologue comments (number of lines of comments)^1 Correct test stub preprocessor statements (yes or no) A main function inside the test stub (number of lines of code) A sequence of line counts for each function definition, sorted in descending order A sequence of cyclomatic complexities for each function definition, sorted in descending order The sum of the function sizes and sum of the cyclomatic complexities
Your ANALYZER program:
files with extensions “.h” or “.cpp” are analyzed, while files with extensions “.xml” are used for display. You are encouraged to use the semi and tok modules, provided in proj #2 help folder in the class directory, to scan a file for analysis. One way to organize your design is for the analysis class to extract semiexpressons^5 , the output of the semi module, to present to the analysis functor. If the semiexpression is useful for analysis it will be the source information gathered by the functor. Otherwise the functor simply ignores the semiexpression and returns. To help you understand the display requirements, here is a sample acceptable output format: JohnDoe Exec.cpp Preprocessor statements: no Prologue lines: 43 Main line count: 11 cyclo: 12, 11, 8 – 31 sizes: 35, 22, 12 – 69 Analysis.h Preprocessor statements: yes Prologue lines: 65 cyclo: 1, 1, 1 - 3 sizes: 5, 3, 3 – 11 Analysis.cpp Preprocessor statements: yes Prologue lines: 7 Main line count: 22 cyclo: 11, 7, 7, 5, 1, 1 - 32 sizes: 55, 37, 31, 22, 15, 5 - 165 Note that there are a number of opportunities for elegant partitioning of your design. For example, you may wish to have your functors provide a display function that is responsible for one line of output for each block. The analysis module then simply asks each functor to analyze then display its results. You are further encouraged to find other places in your design to use templates to simplify the design or implementation. (^5) A semi expression is a sequence of tokens that are particularly useful for code analysis. We will discuss semiexpressions in class.