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 条
  • [1] Trieste: A C plus plus DSL for Flexible Tree Rewriting
    Clebsch, Sylvan
    Blomqvist, Matilda
    Castegren, Elias
    Johnson, Matthew A.
    Parkinson, Matthew J.
    PROCEEDINGS OF THE 17TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON SOFTWARE LANGUAGE ENGINEERING, SLE 2024, 2024, : 184 - 189
  • [2] Visualization of C plus plus Template Metaprograms
    Borok-Nagy, Zoltan
    Majer, Viktor
    Mihalicza, Jozsef
    Pataki, Norbert
    Porkolab, Zoltan
    2010 10TH IEEE INTERNATIONAL WORKING CONFERENCE ON SOURCE CODE ANALYSIS AND MANIPULATION, 2010, : 167 - 176
  • [3] Implementing monads for C plus plus template metaprograms
    Sinkovics, Abel
    Porkolab, Zoltan
    SCIENCE OF COMPUTER PROGRAMMING, 2013, 78 (09) : 1600 - 1621
  • [4] Intrinsic Currying for C plus plus Template Metaprograms
    Keir, Paul
    Gozillon, Andrew
    Haeri, Seyed Hossein
    TRENDS IN FUNCTIONAL PROGRAMMING (TFP 2018), 2019, 11457 : 46 - 73
  • [5] Towards More Reliable C plus plus Template Metaprograms
    Sinkovics, Abel
    Sajo, Endre
    Porkolab, Zoltan
    12TH SYMPOSIUM ON PROGRAMMING LANGUAGES AND SOFTWARE TOOLS, SPLST' 11, 2011, : 260 - 271
  • [6] Compiler Support for Profiling C plus plus Template Metaprograms
    Mihalicza, Jozsef
    Pataki, Norbert
    Porkolab, Zoltan
    12TH SYMPOSIUM ON PROGRAMMING LANGUAGES AND SOFTWARE TOOLS, SPLST' 11, 2011, : 32 - 43
  • [7] The preliminary investigation of template with C plus
    Sandal, Shruti
    Singh, Raghuraj
    Khilji, Abdul Jabbar
    Ranga, Shashi Shekhar
    Tejasvee, Sanjay
    Gahlot, Devendra
    INTERNATIONAL CONFERENCE ON METHODS AND MODELS IN SCIENCE AND TECHNOLOGY (ICM2ST-10), 2010, 1324 : 54 - +
  • [8] DSL plus ISP = CLEC
    Llana, A
    COMMUNICATIONS NEWS, 1998, 35 (11): : 14 - +
  • [9] DSParLib: A C plus plus Template Library for Distributed Stream Parallelism
    Loff, Junior
    Hoffmann, Renato B.
    Pieper, Ricardo
    Griebler, Dalvan
    Fernandes, Luiz G.
    INTERNATIONAL JOURNAL OF PARALLEL PROGRAMMING, 2022, 50 (5-6) : 454 - 485
  • [10] Multicore C plus plus Standard Template Library with C++0x
    Szugyi, Zalan
    Torok, Mark
    Pataki, Norbert
    Kozsik, Tamas
    NUMERICAL ANALYSIS AND APPLIED MATHEMATICS ICNAAM 2011: INTERNATIONAL CONFERENCE ON NUMERICAL ANALYSIS AND APPLIED MATHEMATICS, VOLS A-C, 2011, 1389