DOI: 10.17587/prin.15.275-287
Language Tools for Processing Trees
V. N. Markov, D. Sc. (Engineering), Professor, vinitar@yandex.ru, Kuban State Technological University, Krasnodar, 350000, Russian Federation
Corresponding author: Vitaly N. Markov, D. Sc. (Engineering), Professor, Kuban State Technological University, Krasnodar, 350000, Russian Federation, E-mail: vinitar@yandex.ru
Received on February 13, 2024
Accepted on March 26, 2024
The new language tools for processing trees based on nodes enumerators and determinants of the depth-first traversal are proposed. Node enumerators define a tree slice and set the directions and step of its breadth-first traversal: from left to right or from right to left, from root to crown or vice versa. The arguments of the nodes enumerators are the arithmetic series of their coordinates in the tree. The traversal determinants specify a way to recursively perform a depth-first traverse. The arguments of the determinants of the recursive depth-first traversal are the aliases of nodes and the ranks of references to their successors. The second-order functions and the recursive comprehension operators over trees similar to list comprehension operators are introduced.
Using these tools allows for concisely expressing the operators to building and processing trees/slice without explicitly using recursion.
Keywords: nodes enumerator, node coordinates, tree slice, code readability, code conciseness, higher-order function, recursive comprehensions
pp. 275—287
For citation:
Markov V. N. Language Tools for Processing Trees, Programmnaya Ingeneria, 2024, vol. 15, no. 6, pp. 275—287. DOI: 10.17587/prin.15.275-287.
References:
- Markov V. N. Enumerator-arguments as a language tool for defining loops, Programmnaya ingeneria, 2023, vol. 14, no. 5, pp. 232—244. DOI: 10.17587/prin.14.232-244 (in Russian).
- Knuth D. E. The Art of Computer Programming, vol. 1: Fundamental Algorithms, 3rd ed. Addison-Wesley, 1997, 650 p.
- Kas'yanov V. N., Evstigneev V. A. Graphs in programming: processing, visualization and application, Saint Petersburg, BHV-Peterburg, 2003, 1104 p. (in Russian).
- Wirth N. Algorithms + data structures = programs, Prentice-Hall, 1976, 361 p.
- Skiena S. S. The Algorithm Design Manual, 3rd ed. Springer, 2020, 793 p.
- de Berg M., van Kreveld M., Overmars M., Cheong O. (formerly Schwarzkopf O.). Computational geometry: algorithms and applications, 2nd, rev. ed. Springer, 2000, 367 p.
- Markov V. N. Umbrella Trees for Nesting Problem, Informacionnye texnologii, 2023, vol. 29, no. 3, pp. 143—148. DOI: 10.17587/it.29.143-148 (in Russian).
- Canon, available at: https://www.canon.ru/for_home/prod-uct_finder/cameras/digital_slr/eos_5ds_r/specifications.html (date of access 15.03.2024).
- A Gentle Introduction to Haskell, available at: https://www. haskell.org/tutorial/goodies.html (date of access 07.02.2024).
- Pierce Benjamin C. Types and Programming Languages, MIT, 2002, 648 pp.
- Markov V. N. Modern logic programming in Visual Prolog 7.5: textbook, Saint Petersburg, BHV-Peterburg, 2016, 544 p. (in Russian).
- Field Anthony J., Harrison Peter G. Functional Programming, Addison-Wesley, 1988, 616 p.