• A novel methodology for aiding the source code metrics extraction process. • Is based on the creation of dynamic tree data models as source code representation. • The tree data models are created from querying the programming language grammar. • The methodology is programming language and programming paradigm independent. 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.