Revisiting Halstead’s Metrics through Abstract Syntax Trees in C
Halstead’s Software Science defines software complexity based on the number of operators and operands in a program. However, traditional implementations rely on lexical tokenization, which may count syntactic artifacts—such as punctuation, delimiters, and type specifiers—that are not necessarily related to cognitive effort or program comprehension. This work revisits Halstead’s metrics by introducing halsteadpp, a tool that identifies operators and operands directly from the program’s Abstract Syntax Tree (AST). By inspecting structural nodes rather than raw lexical tokens, the approach reduces syntactic noise and focuses on elements that reflect the program’s logical behavior. We reexamined the nature of operators and operands in C in light of their actual role and impact within an AST-based approach, and we compared the resulting metrics with those obtained through a conventional Halstead count applied to a selection sort implementation. Next, we extend our AST-based analysis to several sorting algorithms implemented in C. The results reveal that the AST-based interpretation yields distinct complexity profiles across algorithms. Although the findings are preliminary, they suggest that incorporating AST information may support more interpretable analyses of metric variation.
Sat 18 AprDisplayed time zone: Brasilia, Distrito Federal, Brazil change
11:00 - 12:30 | |||
11:00 30mTalk | Revisiting Halstead’s Metrics through Abstract Syntax Trees in C STATIC Arthur Morgado Teixeira Universidade Vila Velha, Abrantes Araújo Silva Filho Universidade Vila Velha, Jean-Rémi Bourguet Universidade Vila Velha | ||
11:30 30mTalk | FP-Predictor – False Positive Prediction for Static Analysis Reports STATIC Tom Ohlmer Paderborn University, Michael Schlichtig Heinz Nixdorf Institute at Paderborn University, Eric Bodden Heinz Nixdorf Institute at Paderborn University & Fraunhofer IEM Pre-print | ||