IPSJ Transactions on Programming Article

Posted on April 27, 2020


松村有倫, 渡部卓雄
情報処理学会論文誌プログラミング(PRO), Vol. 13, No. 2, pp. 1-13, 情報処理学会, Apr., 2020. URL




An Abstraction Mechanism for Modeling Stateful Behaviors in an FRP Language for Embedded Systems

Arimichi Matsumura & Takuo Watanabe
IPSJ Transactions on Programming (PRO), Vol. 13, No. 2, pp. 1-13, Information Processing Sociey of Japan, Apr., 2020 (in Japanese). URL


Embedded systems are classified as reactive systems, which respond to external input and update their states. Developing such systems tend to be complicated because many of those systems change their behavior depending on the internal states. To support developing embedded reactive systems, we propose an abstraction mechanism that provides a method to express state-dependent behaviors in the style of Functional Reactive Programming (FRP). Specifically, we introduce a variant of switch-extension to Emfrp, an FRP language designed for small-scale embedded system. This extension provides a mechanism to define time-varying values and state transitions for each state. It enables us to describe stateful reactive systems in a declarative way. Also, the language targets small-scale embedded systems such as microcontrollers. Thus, dynamic memory allocation is not desirable because it may cause runtime error due to unpredictable memory consumption. The proposed extension statically defines the set of states included in transitions to limit possible behaviors. We implement the switch-extension as the source-code translation to pure Emfrp codes. We show an example to demonstrate that the extension adequately modularizes stateful components.