Abstract

Abstract A domain specific language (DSL) focuses on the essential concepts in a specific problem domain, and abstracts from low-level implementation details. The development of DSLs usually centers around the meta-model, grammar and code generator, possibly extended with transformations to analysis models. Typically, little attention is given to the formal semantics of the language, whereas this is essential for reasoning about DSL models, and for assessing the correctness of the generated code and analysis models. We argue that the semantics of a DSL should be defined explicitly and independently of any code generator, to avoid all kinds of complexities from low-level implementation details. As the generated analysis models must reflect some of these implementation details, we propose to formalize them separately. To assess the correctness and consistency of the generated code and analysis models in a practical way, we use conformance testing. We extensively illustrate this general approach using specific formalizations for an industrial DSL on collision prevention. We do not aim for a generic semantic model for any DSL, but this specific DSL indicates the potential of a modular semantics to facilitate reuse among DSLs.

Highlights

  • Well-known programming languages such as C++ and Java are general purpose languages (GPLs) that are universally applicable

  • The second question is about the correctness of each generated artifact: “Generating implementation code and analysis models is valuable, but how do we know that these artifacts are any good?” Checking the correctness of generated artifacts consists of two parts: whether they are syntactically correct, and whether they conform to the semantics of the domain specific language (DSL)

  • When performance analysis models are generated from DSL models, the generated models are only useful if they follow the relevant implementation details that were introduced by a specific code generator

Read more

Summary

Introduction

Well-known programming languages such as C++ and Java are general purpose languages (GPLs) that are universally applicable. The language component is based on the essential concepts of a specific domain, and abstracts from low-level implementation details. The development of DSLs usually centers around defining the syntax of the language component (in terms of a meta-model or grammar depending on the tools being used) and a code generator, possibly extended with transformations to analysis models. Little attention is given to the formal semantics of the language, and to the implementation details introduced by a particular code generator that are relevant for some of the analysis models. Contribution In this article we focus on the significance of developing a formal semantics for a DSL and the impact of some low-level implementation details on the generated artifacts. We propose practical solutions for three questions: 1. What is the precise meaning of the language elements?

How to validate the consistency between generated artifacts?
General approach
Semantics versus implementation details
Conformance testing
Industrial case study
Platform
Prototype DSL
Challenge
Syntax
Semantics
External interfaces
Expressions and conditions
State-based semantic module for determining active restrictions
Function-based semantic module for computing output speed requests
Semantics of a DSL model
Formalizing implementation details
Module for time-consuming operations of restrictions
Evaluating expressions and conditions
Evaluating restrictions
Time-consuming operations performed by a DSL model
Testing hypothesis
Conformance relations
Test cases
Coverage criteria
Evaluation Stimulus End of Evaluation
Practical remarks
Implementation code of the safety layer
Performance model of the safety layer
Test case generation
Case study results
Mathematically undefined operations
Semantics of restrictions
Computation accuracies
Symmetric distance queries
Lazy evaluation for conditions
10. Afterthought: towards a modular semantics for DSLs
11. Related work
12. Conclusions and future work
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call