Open Pattern Matching for C plus

被引:0
|
作者
Solodkyy, Yuriy [1 ]
Dos Reis, Gabriel [1 ]
Stroustrup, Bjarne [1 ]
机构
[1] Texas A&M Univ, College Stn, TX 77843 USA
关键词
Pattern Matching; C plus;
D O I
10.1145/2637365.2517222
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Pattern matching is an abstraction mechanism that can greatly simplify source code. We present functional-style pattern matching for C++ implemented as a library, called Mach7(1). All the patterns are user-definable, can be stored in variables, passed among functions, and allow the use of class hierarchies. As an example, we implement common patterns used in functional languages. Our approach to pattern matching is based on compile-time composition of pattern objects through concepts. This is superior (in terms of performance and expressiveness) to approaches based on run-time composition of polymorphic pattern objects. In particular, our solution allows mapping functional code based on pattern matching directly into C++ and produces code that is only a few percent slower than hand-optimized C++ code. The library uses an efficient type switch construct, further extending it to multiple scrutinees and general patterns. We compare the performance of pattern matching to that of double dispatch and open multi-methods in C++.
引用
收藏
页码:33 / 42
页数:10
相关论文
共 50 条
  • [1] Pattern Matching in an Open World
    Zhang, Weixin
    Oliveira, Bruno C. d. S.
    PROCEEDINGS OF THE 17TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON GENERATIVE PROGRAMMING: CONCEPTS AND EXPERIENCES (GPCE'18), 2018, : 134 - 146
  • [2] Evaluating C plus plus design pattern miner tools
    Fulop, Lajos Jeno
    Gyovai, Tamas
    Ferenc, Rudolf
    SIXTH IEEE INTERNATIONAL WORKSHOP ON SOURCE CODE ANALYSIS AND MANIPULATION, PROCEEDINGS, 2006, : 127 - +
  • [3] NiHu: An open source C plus plus BEM library
    Fiala, P.
    Rucz, P.
    ADVANCES IN ENGINEERING SOFTWARE, 2014, 75 : 101 - 112
  • [4] mr: A C plus plus library for the matching and running of the Standard Model parameters
    Kniehl, Bernd A.
    Pikelner, Andrey F.
    Veretin, Oleg L.
    COMPUTER PHYSICS COMMUNICATIONS, 2016, 206 : 84 - 96
  • [5] A Software Vulnerability Dataset of Large Open Source C/C plus plus Projects
    Pereira, Jose D'Abruzzo
    Antunes, Joao Henggeler
    Vieira, Marco
    2022 IEEE 27TH PACIFIC RIM INTERNATIONAL SYMPOSIUM ON DEPENDABLE COMPUTING (PRDC), 2022, : 152 - 163
  • [6] A C plus plus Generic Parallel Pattern Interface for Stream Processing
    del Rio Astorga, David
    Dolz, Manuel F.
    Miguel Sanchez, Luis
    Garcia Blas, Javier
    Daniel Garcia, J.
    ALGORITHMS AND ARCHITECTURES FOR PARALLEL PROCESSING, ICA3PP 2016, 2016, 10048 : 74 - 87
  • [7] Open and Efficient Type Switch for C plus
    Solodkyy, Yuriy
    Dos Reis, Gabriel
    Stroustrup, Bjarne
    ACM SIGPLAN NOTICES, 2012, 47 (10) : 963 - 982
  • [8] BES plus plus : HPC Profile Open Source C Implementation
    Ruiz-Alvarez, Arkaitz
    Smith, Christopher
    Humphrey, Marty
    2008 9TH IEEE/ACM INTERNATIONAL CONFERENCE ON GRID COMPUTING, 2008, : 41 - +
  • [9] Design and evaluation of C plus plus open multi-methods
    Pirkelbauer, Peter
    Solodkyy, Yuriy
    Stroustrup, Bjarne
    SCIENCE OF COMPUTER PROGRAMMING, 2010, 75 (07) : 638 - 667
  • [10] Pattern-based Synthesis of Synchronization for the C plus plus Memory Model
    Meshman, Yuri
    Rinetzky, Noam
    Yahav, Eran
    PROCEEDINGS OF THE 15TH CONFERENCE ON FORMAL METHODS IN COMPUTER-AIDED DESIGN (FMCAD 2015), 2015, : 120 - 127