Files

Pyttern___SCLIT.pdf
  • Open Access
  • Adobe PDF
  • 727.45 KB
SCLIT25-PDFpresentation.pdf
  • Open Access
  • Adobe PDF
  • 963.82 KB

Details

Authors
Abstract
Despite the availability of numerous tools and languages for detecting structural patterns in programs, their complexity often presents a steep learning curve. This highlights the need for a program query language that is easier to learn, use, and read while remaining sufficiently expressive for defining and detecting relevant structural coding patterns in program code. To address this challenge, we present Pyttern, a query language that extends Python syntax with regular-expression-inspired wildcards, enabling intuitive pattern-based querying of Python code. Its implementation relies upon a custom pushdown automaton describing how to match patterns over program parse trees, thus providing a robust foundation for structural code analysis. We evaluate Pyttern’s usability and effectiveness through a study involving 35 master’s students, who were asked to write seven different patterns to identify known programming misconceptions. The results demonstrate that Pyttern is both easy to learn and practical to use, at least for analysing small-scale programs.
Affiliations

Citations

Liénard, J., Mens, K., & Nijssen, S. (2025). The Pyttern Program Query Language. Companion Proceedings of the 9th International Conference on the Art, Science, and Engineering of Programming (Programming 2025), 134(23), 1-23:15. https://hdl.handle.net/2078.5/256576 (Original work published 2025)