Formal Semantic Specification of Domain-Specific Modeling Languages for Cyber-Physical Systems
Model-Integrated Computing is increasingly used for designing Cyber-Physical Systems (CPS), since it increases productivity and product quality through simulators, automated testing, code generators and verification tools. In this approach, models are represented using Domain-Specific Modeling Languages (DSMLs). A DSML is defined by its syntax and semantics, and while meta-modeling (and meta-modeling environments) provides a mature methodology for tackling the syntax of DSMLs, expressing the semantics of a DSML is still in its infancy. Without unambiguous specifications, different tools may interpret the languages in different ways, which could easily lead to situations when the compiler generates code with different behavior than what the verification tool analyzes. Therefore, in order to help the development of consistent tools, we need to formalize the semantics of these languages. In this work, we discuss the formalization of the structural and behavioral semantics of CPS DSMLs using a logic programming based approach. We introduce ForSpec, an executable formal specification language for the structural and behavioral semantics of CPS DSMLs. ForSpec is a constraint logic programming language based on fixed-point logic over algebraic data types with support for both denotational and operational specifications. In order to help the development of denotational semantic specifications, we introduce an extension of the semantic anchoring framework, and define several reusable semantic units for CPS modeling languages in ForSpec. Using these semantic units, we demonstrate the complete formalization of the structural and denotational semantics of a bond graph language and a CPS modeling language. Finally, in order to demonstrate operational specifications in ForSpec, we develop the structural and operational semantic specifications for the MathWorks Stateflow language.