Abstract
We present Code-centric Code Generation (CCG), an approach designed to ease the development and evolution of template-based code generators. The key idea is to generate the required templates from appropriately annotated runnable prototypes written in the target language. In essence, this turns template definition into a two-step process: 1. writing a prototype (base configuration) in the target language, and 2. annotating the prototype’s AST with parameterized operations that, given the required parameters, allow one to transform this base configuration into the intended target code. The advantage of this approach is that prototypes, in contrast to templates, can be conveniently developed and evolved with the full tool support of common software development. We illustrate the ease of CCG-based code generator development by first specifying and then evolving the required templates in order to overcome a detected security vulnerability. A proof-of-concept implementation is publicly available for reproducibility.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Abd Alrahman, Y., De Nicola, R., Loreti, M.: A calculus for collective-adaptive systems and its behavioural theory. Inf. Comput. 268, 104457 (2019)
Arnoldus, J., Bijpost, J., van den Brand, M.: Repleo: a syntax-safe template engine. In: Proceedings of the 6th International Conference on Generative Programming and Component Engineering, pp. 25–32 (2007)
Busch, D.: Towards code-centric code generators. Electronic Communication of the European Association of Software Science and Technology (2023)
De Nicola, R., Ferrari, G., Loreti, M., Pugliese, R.: A language-based approach to autonomic computing. In: Beckert, B., Damiani, F., de Boer, F.S., Bonsangue, M.M. (eds.) FMCO 2011. LNCS, vol. 7542, pp. 25–48. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-35887-6_2
De Nicola, R., Hennessy, M.C.: Testing equivalences for processes. Theoret. Comput. Sci. 34(1–2), 83–133 (1984)
Jörges, S.: Construction and Evolution of Code Generators: A Model-Driven and Service-Oriented Approach. LNCS, vol. 7747. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-36127-2
Nicola, R.D., Loreti, M., Pugliese, R., Tiezzi, F.: A formal approach to autonomic systems programming: the SCEL language. ACM Trans. Auton. Adap. Syst. (TAAS) 9(2), 1–29 (2014)
Parr, T.J., Quong, R.W.: ANTLR: a predicated-LL (k) parser generator. Softw. Pract. Exp. 25(7), 789–810 (1995)
Pech, V., Shatalin, A., Voelter, M.: JetBrains MPS as a tool for extending Java. In: Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools, PPPJ 2013, pp. 165–168. Association for Computing Machinery, New York (2013). https://doi.org/10.1145/2500828.2500846
Smyth, S.: Interactive Model-Based Compilation — A Modeller-Driven Development Approach. No. 2021/1 in Kiel Computer Science Series, Department of Computer Science, CAU Kiel (2021). https://doi.org/10.21941/kcss/2021/10, dissertation, Faculty of Engineering, Kiel University
Syriani, E., Luhunu, L., Sahraoui, H.: Systematic mapping study of template-based code generation. Comput. Lang. Syst. Struct. 52, 43–62 (2018)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Busch, D., Smyth, S., Tegeler, T., Steffen, B. (2025). Code-Centric Code Generation. In: Margaria, T., Steffen, B. (eds) Leveraging Applications of Formal Methods, Verification and Validation. REoCAS Colloquium in Honor of Rocco De Nicola. ISoLA 2024. Lecture Notes in Computer Science, vol 15219. Springer, Cham. https://doi.org/10.1007/978-3-031-73709-1_21
Download citation
DOI: https://doi.org/10.1007/978-3-031-73709-1_21
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-73708-4
Online ISBN: 978-3-031-73709-1
eBook Packages: Computer ScienceComputer Science (R0)