Dynamic creation of source code models for the extraction of code metrics data through grammar querying Article uri icon


  • Source code metrics extraction is a complex task that has to be done automatically given the current size of software. They are extracted using software metric tools and more generic extraction mechanisms. These mechanisms usually work by querying a source code representation model. These models are static, and the information that can be obtained from them is limited. In this work an extraction methodology is presented in which the model is created every time certain information is needed. This is accomplished by querying the language context-free grammar, and from the information obtained by the query, a dynamic model is created. Current extraction mechanisms work by querying a model, while the proposed methodology queries the grammar directly, thus the model is created afterwards from the query result, and contains all the needed information. A metrics tool is created based on the proposed methodology, and in order to prove the correct functioning of extracting the desired information from the source code, not as already predefined as in current tools, several metrics are extracted as defined by four existing metrics tools. Querying the language grammar allows access to all available data in the source code, regardless of the programming language and paradigm. © 2020 Elsevier B.V.

publication date

  • 2020-01-01