The project involves building a compiler using ANTLR4, a powerful parser generator, to support measuring the code coverage of a suite of input tests running on an input program. The project will define a set of tokens and grammar rules in a .g4 file, which will be used by ANTLR4 to generate the lexer and parser components of the compiler. The design will support either the -visitor or -no-listener options in ANTLR4, depending on the implementation preference.
The goal is to develop a testing language that can be conveniently used to write tests for various functions, methods, modules, or classes. This testing language may be a subset of the input programming language's syntax and will be designed to easily define and manage test configurations, potentially including separate configuration files.
Test Case:
Statement Coverage:
Condition Coverage:
All-Defs Coverage:
All-C-Uses Coverage:
All-P-Uses Coverage:

Key features include:
-
Design of Tokens and Grammar Rules: The project will specify tokens and syntactic rules in the
.g4file for the ANTLR4 tool to generate the necessary lexer and parser. This design will cover essential programming features, possibly inspired by popular programming languages. -
Testing Language Specification: The testing language will be designed to allow convenient writing of tests, supporting various testing styles. This will include the ability to specify individual tests and their combinations.
-
HTML Output for Code Coverage: The compiler will output code coverage reports in HTML format. This will include detailed, cross-referenced information about the program coverage, similar to tools like EclEmma for Java in Eclipse. The HTML output will feature user-friendly navigation, including hyperlinks to navigate between covered parts of the program and the corresponding tests.
-
Support for Multiple Input Files: The compiler will accept multiple plain text files as input, representing both the program and the tests. It will produce a set of HTML files, with
index.htmlserving as the main entry point for navigation.
Overall, the project aims to provide a comprehensive tool for analyzing and visualizing code coverage, helping users to understand how thoroughly their tests cover the program. The output should be detailed and accessible, ensuring that users can easily identify areas of the program that require additional testing or refactoring.