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 条
  • [21] Ungar - A C plus plus Framework for Real-Time Optimal Control Using Template Metaprogramming
    De Vincenti, Flavio
    Coros, Stelian
    2023 IEEE/RSJ INTERNATIONAL CONFERENCE ON INTELLIGENT ROBOTS AND SYSTEMS (IROS), 2023, : 6297 - 6303
  • [22] GTMesh: A Highly Efficient C plus plus Template Library for Numerical Schemes on General Topology Meshes
    Jakubec, Tomas
    Strachota, Pavel
    APPLIED SCIENCES-BASEL, 2023, 13 (15):
  • [23] ROBUSfT: Robust real-time shape-from-template, a C plus plus library
    Shetab-Bushehri, Mohammadreza
    Aranda, Miguel
    Ozgur, Erol
    Mezouar, Youcef
    Bartoli, Adrien
    IMAGE AND VISION COMPUTING, 2024, 141
  • [24] Linear algebra with C plus plus template metaprograms - Rapid linear algebra is just one use
    Veldhuizen, T
    Ponnambalam, K
    DR DOBBS JOURNAL, 1996, 21 (08): : 38 - +
  • [25] Practical Sparse Matrices in C plus plus with Hybrid Storage and Template-Based Expression Optimisation
    Sanderson, Conrad
    Curtin, Ryan
    MATHEMATICAL AND COMPUTATIONAL APPLICATIONS, 2019, 24 (03)
  • [26] C for C plus plus programmers
    Stevens, A
    DR DOBBS JOURNAL, 1997, 22 (07): : 99 - 102
  • [27] C plus plus and Interoperability Between Libraries: The GraphBLAS C plus plus Specification
    Brock, Benjamin
    McMillan, Scott
    Buluc, Aydin
    Mattson, Timothy G.
    Moreira, Jose E.
    2023 IEEE INTERNATIONAL PARALLEL AND DISTRIBUTED PROCESSING SYMPOSIUM WORKSHOPS, IPDPSW, 2023, : 207 - 215
  • [28] C plus plus builder
    Brauer, R
    DR DOBBS JOURNAL, 1997, 22 (07): : 12 - 12
  • [29] C plus plus constructors
    Meyers, S
    DR DOBBS JOURNAL, 1997, 22 (05): : 10 - 10
  • [30] C plus plus standards
    Myers, N
    DR DOBBS JOURNAL, 1997, 22 (11): : 10 - +