Trieste: A C plus plus DSL for Flexible Tree Rewriting

被引:0
|
作者
Clebsch, Sylvan [1 ]
Blomqvist, Matilda [2 ]
Castegren, Elias [2 ]
Johnson, Matthew A. [3 ]
Parkinson, Matthew J. [3 ]
机构
[1] Microsoft Azure Res, Austin, TX 78701 USA
[2] Uppsala Univ, Uppsala, Sweden
[3] Microsoft Azure Res, Cambridge, England
关键词
Rewriting; Compilers; Domain-Specific Languages;
D O I
10.1145/3687997.3695647
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Compilation is all about tree rewriting. In functional languages where all data is tree-shaped, tree rewriting is facilitated by pattern matching, but data immutability leads to copying for each update. In object-oriented languages like Java or C++, a standard approach is to use the visitor pattern, which increases modularization but also adds indirection and introduces boilerplate code. In this paper, we introduce Trieste - a novel tree-rewriting DSL, combining the power of C++ with the expressivity of pattern matching. In Trieste, sequences of rewrite passes can be used to read a file to produce an abstract syntax tree (AST), convert from one AST to another, or write an AST to disk. Each pass rewrites an AST in place using subtree pattern matching, where the result is dynamically checked for well-formedness. Checking the well-formedness of trees dynamically enables flexibly changing the tree structure without having to define new data types for each intermediate representation. The well-formedness specification can also be used for scoped name binding and generating random well-formed trees for fuzz testing in addition to checking the shape of trees. Trieste has been used to build fully compliant parsers for YAML and JSON, a transpiler from YAML to JSON, and a compiler and interpreter for the policy language Rego.
引用
收藏
页码:184 / 189
页数:6
相关论文
共 50 条
  • [31] Cost Analysis of B plus -Tree and CSB plus -Tree in Main Memory Database
    Wang, Lan
    Sun, Fengdong
    PROCEEDINGS OF THE 3RD INTERNATIONAL CONFERENCE ON MATERIAL, MECHANICAL AND MANUFACTURING ENGINEERING, 2015, 27 : 914 - 917
  • [32] A Minimalist Open Source Behavior Tree Framework in C plus
    Silva, Gustavo L.
    Maximo, Marcos R. O. A.
    Pereira, Lourenco A.
    2021 LATIN AMERICAN ROBOTICS SYMPOSIUM / 2021 BRAZILIAN SYMPOSIUM ON ROBOTICS / 2021 WORKSHOP OF ROBOTICS IN EDUCATION (LARS-SBR-WRE 2021), 2021, : 306 - 311
  • [33] GreenB plus Tree: an energy-efficient B plus tree for MIMD architectures
    Peng, Muchun
    Wang, Qinglin
    Liang, Yuechao
    Guo, Weihao
    Yang, Shun
    Liang, Yaling
    Shi, Yongzhen
    Cao, Ligang
    Liu, Jie
    CCF TRANSACTIONS ON HIGH PERFORMANCE COMPUTING, 2025, 7 (01) : 72 - 84
  • [34] Quantum plus plus : A modern C plus plus quantum computing library
    Gheorghiu, Vlad
    PLOS ONE, 2018, 13 (12):
  • [35] aflow plus plus : A C plus plus framework for autonomous materials design
    Oses, Corey
    Esters, Marco
    Hicks, David
    Divilov, Simon
    Eckert, Hagen
    Friedrich, Rico
    Mehl, Michael J.
    Smolyanyuk, Andriy
    Campilongo, Xiomara
    van de Walle, Axel
    Schroers, Jan
    Kusne, A. Gilad
    Takeuchi, Ichiro
    Zurek, Eva
    Nardelli, Marco Buongiorno
    Fornari, Marco
    Lederer, Yoav
    Levy, Ohad
    Toher, Cormac
    Curtarolo, Stefano
    COMPUTATIONAL MATERIALS SCIENCE, 2023, 217
  • [36] The magnetic spectrum of beta rays emitted by the ThB plus C plus C' plus C"
    Arnoult, R
    COMPTES RENDUS HEBDOMADAIRES DES SEANCES DE L ACADEMIE DES SCIENCES, 1934, 198 : 1603 - 1605
  • [37] The magnetic spectrum of beta rays emitted by AcB plus C plus C' plus C''
    Graf, T
    COMPTES RENDUS HEBDOMADAIRES DES SEANCES DE L ACADEMIE DES SCIENCES, 1933, 197 : 238 - 241
  • [38] The Pinocchio C plus plus library
    Carpentier, Justin
    Saurel, Guilhem
    Buondonno, Gabriele
    Mirabel, Joseph
    Lamiraux, Florent
    Stasse, Olivier
    Mansard, Nicolas
    2019 IEEE/SICE INTERNATIONAL SYMPOSIUM ON SYSTEM INTEGRATION (SII), 2019, : 614 - 619
  • [39] Mathematizing C plus plus Concurrency
    Batty, Mark
    Owens, Scott
    Sarkar, Susmit
    Sewell, Peter
    Weber, Tjark
    ACM SIGPLAN NOTICES, 2011, 46 (01) : 55 - 66
  • [40] C plus plus constructors - Response
    Meyers, S
    DR DOBBS JOURNAL, 1997, 22 (08): : 12 - 12