A tool to measure Fortran source code metrics using syntax analysis

A.M. Pokrovskyi


The rapid development of software quality measurement methods, the need in efficient and versatile reengineering automatization tools becomes increasingly bigger. This becomes even more apparent when the programming language and respective coding practices slowly develop alongside each other for a long period of time, while the legacy code base grows bigger and remains highly relevant. In this paper, a source code metrics measurement tool for Fortran program quality evaluation is developed. It is implemented as a code module for Photran integrated development environment and based on a set of syntax tree walking algorithms. The module utilizes the built-in Photran syntax analysis engine and the tree data structure which it builds from the source code. The developed tool is also compared to existing source code analysis instruments. The results show that the developed tool is most effective when used in combination with Photran’s built-in refactoring system, and that Photran’s application programming interface facilitates easy scaling of the existing infrastructure by introducing other code analysis methods.

Prombles in programming 2021; 1: 26-35



source code metric; software quality; refactoring


Overbey J.L., Negara S., Johnson R.E. Refactoring and the evolution of Fortran. Workshop on Software Engineering for Computational Science and Engineering, Vancouver, BC. 2009. P. 28–34. CrossRef

Hariprasad T., Vidhyagaran G., Seenu K., Thirumalai C. Software complexity analysis using halstead metrics. International Conference on Trends in Electronics and Informatics (ICEI), Tirunelveli. 2017. P. 1109–1113. CrossRef

McCabe T.J. A Complexity Measure. IEEE Transactions on Software Engineering. 1976. N 4. P. 308–320. CrossRef

Photran Developer's Guide [online] Available at: https://git.eclipse.org/c/ptp/org.eclipse. photran.git/plain/org.eclipse.photran-dev-docs/dev-guide/dev-guide-specialized.pdf [Accessed 12 February 2021].

Metcalf M., Reid J.K. Fortran 90/95 explained. USA: Oxford University Press, Inc. 1999. 341 p. (2).

fpt – Tools for Fortran Engineering [online] Available at: http://www.simconglobal.com/ fpt_summary.html [Accessed 12 February 2021].

García-Rodríguez M., Añel J., Foujols M., Rodeiro J. FortranAnalyser: A software tool to assess Fortran code quality [online] Fortrananalyser.ephyslab.uvigo.es. Available at: http://fortrananalyser.ephyslab.uvigo.es/ docs/access.pdf [Accessed 12 February 2021].

Semanticdesigns.com. n.d. Source Code Search Engine. [online] Available at: http://www.semanticdesigns.com/Products/SearchEngine/?site=SoftwareRecommendations [Accessed 12 February 2021].

Doroshenko A., Zhereb K. and Tulika Y. Parallelization of Fortran programs using rewriting rules. Problems of programming. 2012. Vol. 2-3. P. 388–397.

Deater.net. n.d. 10. Fortran 77 Flowcharting Utility. [online] Available at: http://www.deater.net/weave/vmwprod/f77_diagram [Accessed 12 February 2021].

Lawden M., 1990. FORCHECK – A Fortran Verifier and Programming Aid. Starlink User Note, 73(1). P. 1–3.

DOI: https://doi.org/10.15407/pp2021.01.026


  • There are currently no refbacks.