Typed Canonical Pattern Dictionary for Static Comparison of Structured Text PLC Programs
PDF (Russian)

Keywords

Structured Text
static analysis
canonical pattern
corpus-based dictionary
Levenshtein distance
industrial ventilation

How to Cite

1.
Shchigal S.E., Soloviev V.I. Typed Canonical Pattern Dictionary for Static Comparison of Structured Text PLC Programs // Russian Journal of Cybernetics. 2026. Vol. 7, № 3. P. 133-138.

Abstract

we investigated a method for comparing numerical-control (NC) programs that reduces the sensitivity of literal comparison to variable names while retaining syntactic and semantic information relevant to program structure. We formalized a dictionary of typed canonical Structured Text patterns and evaluated its use for static program comparison. An industrial ventilation project comprising 189 program units was used to construct the dictionary. Statements were converted into signatures that retained statement types, selected expression structures, variable roles and data types, and literal classes. Frequent signatures were included as individual patterns, whereas rare signatures were grouped into generic categories. After correcting syntactic analysis errors, the dataset contained 7,794 statement occurrences. At a pattern depth of one and a minimum frequency of five, the dictionary contained 238 patterns covering 54.0% of all occurrences. Replacing lexical identifiers in 188 modified program units did not change either the full or thresholded pattern sequences. Across six procedures, comparison distances were zero for renamed variants and ranged from one to three for controlled modifications. In an external archive containing 110 program variants, full representations differed from the modal reference in 65 cases at depth one and 75 cases at depth two. The method does not establish functional correctness. Its limitations include loss of variable identity, coarse representation of literals, incomplete syntax coverage, and the absence of independent expert validation of the generated programs.

PDF (Russian)

References

Koziolek H., Gruener S., Ashiwal V. ChatGPT for PLC/DCS Control Logic Generation. 2023 IEEE 28th International Conference on Emerging Technologies and Factory Automation (ETFA). 2023:1–8. DOI: 10.1109/ETFA54631.2023.10275411.

Fakih M., Dharmaji R., Moghaddas Y., Quiros Araya G., Ogundare O., Al Faruque M. A. LLM4PLC: Harnessing Large Language Models for Verifiable Programming of PLCs in Industrial Control Systems. Proceedings of the 46th International Conference on Software Engineering: Software Engineering in Practice. 2024:192–203. DOI: 10.1145/3639477.3639743.

Yefet N., Alon U., Yahav E. Adversarial Examples for Models of Code. Proceedings of the ACM on Programming Languages. 2020;4(OOPSLA):1–30. DOI: 10.1145/3428230.

Roy C. K., Cordy J. R., Koschke R. Comparison and Evaluation of Code Clone Detection Techniques and Tools: A Qualitative Approach. Science of Computer Programming. 2009;74(7):470– 495. DOI: 10.1016/j.scico.2009.02.007.

Kamiya T., Kusumoto S., Inoue K. CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code. IEEE Transactions on Software Engineering. 2002;28(7):654–670. DOI: 10.1109/TSE.2002.1019480.

Luan S., Yang D., Barnaby C., Sen K., Chandra S. Aroma: Code Recommendation via Structural Code Search. Proceedings of the ACM on Programming Languages. 2019;3(OOPSLA):1–28. DOI: 10.1145/3360578.

Allamanis M., Sutton C. Mining Idioms from Source Code. Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. 2014:472–483. DOI: 10.1145/2635868.2635901.

Song Y., Lothritz C., Tang D., Bissyandé T., Klein J. Revisiting Code Similarity Evaluation with Abstract Syntax Tree Edit Distance. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics. 2024;2:38–46. DOI: 10.18653/v1/2024.acl-short.3.

Allamanis M., Barr E. T., Devanbu P., Sutton C. A Survey of Machine Learning for Big Code and Naturalness. ACM Computing Surveys. 2018;51(4):81. DOI: 10.1145/3212695.

Левенштейн В. И. Двоичные коды с исправлением выпадений, вставок и замещений символов. Доклады Академии наук СССР. 1965;163(4):845–848. Режим доступа: https://www.mathnet.ru/rus/dan31411.

Kabir M. H., Islam M. R., Lou H. H. STMutants: A Mutation Testing Dataset for Structured Text Programs in Industrial Automation. 2026. arXiv:2606.05499v1. DOI: 10.48550/arXiv.2606.05499.

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.

Downloads

Download data is not yet available.