A Method for Generating Functional Programming Template Based on Model Transformation
Yi Zhu, Xiaoying Chen, Yu Dan Zhao · 2019 4th International Conference on Mechanical, Control and Computer Engineering (ICMCCE) · 2019
Template meta-programming is a hot topic in programming languages, and functional programming is often employed in template meta-programming. ATS (Applied Type System) is a functional programming language includes formal specification and implementation, and it is good to be used for generating templates. Since ATS templates are difficult to be designed and lack generality, a method for generating ATS template based on model transformation is proposed in this paper. Firstly, an instance for generating Function from Datatype is given based on ATS Template Meta-programming; Secondly, an ATS meta-model includes the definitions of Datatype and Function is constructed by meta-modeling; Thirdly, the transformation from Datatype model to Function model is described in detail; Finally, an example of ATS Template Meta-programming based on model transformation is given to verify the effectiveness of this method. The experiments show that this method can implement ATS templates and increase the generality of ATS in template meta-programming.