DSL in C plus plus Template Metaprogram

被引:1
|
作者
Porkolab, Zoltan [1 ]
Sinkovics, Abel [1 ]
Siroki, Istvan [1 ]
机构
[1] Eotvos Lorand Univ, Dept Programming Languages & Compilers, Fac Informat, Pazmany Peter Setany 1-C, H-1117 Budapest, Hungary
关键词
D O I
10.1007/978-3-319-15940-9_3
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Domain specific language integration has to provide the right balance between the expressive power of the DSL and the implementation and maintenance cost of the applied integration techniques. In this paper we discuss a DSL integration technique for the C++ programming language. The solution is based on compile-time parsing of the DSL code using the C++ template metaprogramming library called Metaparse. The parser generator is the C++ template metaprogram reimplementation of a runtime Haskell parser generator library. The full parsing phase is executed when the host program is compiled. The library uses only standard C++ language features, thus our solution is highly portable. As a demonstration of the power of this approach, we present a highly efficient and type-safe version of printf and the way it can be constructed using our library. Despite the well known syntactical difficulties of C++ template metaprograms, building embedded languages using Metaparse leads to self-documenting maintenable C++ source code.
引用
收藏
页码:76 / 114
页数:39
相关论文
共 50 条
  • [31] C plus plus evolves!
    Naumann, Axel
    20TH INTERNATIONAL CONFERENCE ON COMPUTING IN HIGH ENERGY AND NUCLEAR PHYSICS (CHEP2013), PARTS 1-6, 2014, 513
  • [32] C plus plus constructors
    Plochan, F
    DR DOBBS JOURNAL, 1997, 22 (08): : 10 - +
  • [33] Algorithmic differentiation and hull-consistency enforcing using C plus plus template meta-programming
    Kubica, Bartlomiej Jacek
    NUMERICAL ALGORITHMS, 2023, 94 (04) : 1673 - 1704
  • [34] Challenges Porting a C plus plus Template-Metaprogramming Abstraction Layer to Directive-Based Offloading
    Kelling, Jeffrey
    Bastrakov, Sergei
    Debus, Alexander
    Kluge, Thomas
    Leinhauser, Matt
    Pausch, Richard
    Steiniger, Klaus
    Stephan, Jan
    Widera, Rene
    Young, Jeff
    Bussmann, Michael
    Chandrasekaran, Sunita
    Juckeland, Guido
    ACCELERATOR PROGRAMMING USING DIRECTIVES, WACCPD 2021, 2022, 13194 : 92 - 111
  • [35] Algorithmic differentiation and hull-consistency enforcing using C plus plus template meta-programming
    Bernigaud, Antoine
    Gratton, Serge
    Simon, Ehouarn
    NUMERICAL ALGORITHMS, 2024, 95 (01) : 471 - 497
  • [36] A C plus plus Template Library for Efficient Forward-Time Population Genetic Simulation of Large Populations
    Thornton, Kevin R.
    GENETICS, 2014, 198 (01) : 157 - +
  • [37] The Quetzal Coalescence template library: A C plus plus programmers resource for integrating distributional, demographic and coalescent models
    Becheler, Arnaud
    Coron, Camille
    Dupas, Stephane
    MOLECULAR ECOLOGY RESOURCES, 2019, 19 (03) : 788 - 793
  • [38] Synchronising C/C plus plus and POWER
    Sarkar, Susmit
    Memarian, Kayvan
    Owens, Scott
    Batty, Mark
    Sewell, Peter
    Maranget, Luc
    Alglave, Jade
    Williams, Derek
    ACM SIGPLAN NOTICES, 2012, 47 (06) : 311 - 321
  • [39] UPC plus plus : A PGAS Extension for C plus
    Zheng, Yili
    Kamil, Amir
    Driscoll, Michael B.
    Shan, Hongzhang
    Yelick, Katherine
    2014 IEEE 28TH INTERNATIONAL PARALLEL AND DISTRIBUTED PROCESSING SYMPOSIUM, 2014,
  • [40] ROC plus plus : Robust Optimization in C plus
    Vayanos, Phebe
    Jin, Qing
    Elissaios, George
    INFORMS JOURNAL ON COMPUTING, 2022, 34 (06) : 2873 - 2888