Contracts for Domain-Specific Languages in Ruby

被引:2
|
作者
Strickland, T. Stephen [1 ]
Ren, Brianna M. [1 ]
Foster, Jeffrey S. [1 ]
机构
[1] Univ Maryland, College Pk, MD 20742 USA
关键词
domain-specific languages; software contracts; INFERENCE; MACROS;
D O I
10.1145/2661088.2661092
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
This paper concerns object-oriented embedded DSLs, which are popular in the Ruby community but have received little attention in the research literature. Ruby DSLs implement language keywords as implicit method calls to self; language structure is enforced by adjusting which object is bound to self in different scopes. While Ruby DSLs are powerful and elegant, they suffer from a lack of specification. In this paper, we introduce contracts for Ruby DSLs, which allow us to attribute blame appropriately when there are inconsistencies between an implementation and client. We formalize Ruby DSL contract checking in ! DSL, a core calculus that uses premethods with instance evaluation to enforce contracts. We then describe RDL, an implementation of Ruby DSL contracts. Finally, we present two tools that automatically infer RDL contracts: TypeInfer infers simple, type-like contracts based on observed method calls, and DSLInfer infers DSL keyword scopes and nesting by generating and testing candidate DSL usages based on initial examples. The type contracts generated by TypeInfer work well enough, though they are limited in precision by the small number of tests, while DSLInfer finds almost all DSL structure. Our goal is to help users understand a DSL from example programs.
引用
收藏
页码:23 / 34
页数:12
相关论文
共 50 条
  • [1] Domain-specific model differencing for graphical domain-specific languages
    Jafarlou, Manouchehr Zadahmad
    [J]. ACM/IEEE 25TH INTERNATIONAL CONFERENCE ON MODEL DRIVEN ENGINEERING LANGUAGES AND SYSTEMS, MODELS 2022 COMPANION, 2022, : 205 - 208
  • [2] On domain-specific languages reengineering
    Alias, C
    Barthou, D
    [J]. GENERATIVE PROGRAMMING AND COMPONENT ENGINEERING, PROCEEDINGS, 2005, 3676 : 63 - 77
  • [3] Unembedding Domain-Specific Languages
    Atkey, Robert
    Lindley, Sam
    Yallop, Jeremy
    [J]. HASKELL'09: PROCEEDINGS OF THE 2009 ACM SIGPLAN HASKELL SYMPOSIUM, 2009, : 37 - 48
  • [4] On the Globalization of Domain-Specific Languages
    Cheng, Betty H. C.
    Combemale, Benoit
    France, Robert B.
    Jezequel, Jean-Marc
    Rumpe, Bernhard
    [J]. GLOBALIZING DOMAIN-SPECIFIC LANGUAGES, 2015, 9400 : 1 - 6
  • [5] Macros for Domain-Specific Languages
    Ballantyne, Michael
    King, Alexis
    Felleisen, Matthias
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4
  • [6] DSMCompare: domain-specific model differencing for graphical domain-specific languages
    Manouchehr Zadahmad
    Eugene Syriani
    Omar Alam
    Esther Guerra
    Juan de Lara
    [J]. Software and Systems Modeling, 2022, 21 : 2067 - 2096
  • [7] DSMCompare: domain-specific model differencing for graphical domain-specific languages
    Zadahmad, Manouchehr
    Syriani, Eugene
    Alam, Omar
    Guerra, Esther
    de Lara, Juan
    [J]. SOFTWARE AND SYSTEMS MODELING, 2022, 21 (05): : 2067 - 2096
  • [8] SLL: A Method for Constructing and Executing Smart Law Contracts Based on Domain-Specific Languages
    Wen, Hao
    Zhu, Jianming
    Zhong, Danfeng
    Chen, Yunzhi
    [J]. BLOCKCHAIN TECHNOLOGY AND APPLICATION, CBCS 2023, 2024, 2098 : 3 - 28
  • [9] Untangling Crosscutting Concerns in Domain-specific Languages with Domain-specific Join Points
    Dinkelaker, Tom
    Monperrus, Martin
    Mezini, Mira
    [J]. DSAL09: DOMAIN-SPECIFIC ASPECT LANGUAGES, 2009, : 1 - 5
  • [10] Domain-Specific Languages in Scientific Computing
    Hinsen, Konrad
    [J]. COMPUTING IN SCIENCE & ENGINEERING, 2018, 20 (01) : 88 - 92