SIGPRO126 Talk

Posted on October 30, 2019

組込みシステム向けFRP言語における状態依存動作のための抽象化機構

松村有倫, 渡部卓雄
情報処理学会第126回プログラミング研究会(SIGPRO126), 国立情報学研究所, 2019年10月30-31日.

概要

外部からの入力に対して自身の状態を更新しながら応答を続けるリアクティブシステムの典型例として組込みシステムを挙げることができる.組込みシステムの多くは状態遷移を含み,状態に応じて振る舞いを変化させる必要があるためプログラムが複雑になる.本研究では,小規模組込みシステムを対象とした関数リアクティブプログラミング(FRP)言語であるEmfrpに対し,システムの状態に応じて計算の動的な切り替えを行うための抽象化機構を導入するswitch拡張を提案する.switch拡張は状態ごとに時変値と次に遷移する状態の計算を記述するための機構を提供し,FRPの枠組みの中で状態遷移を扱うことを可能にする.これによって状態遷移を含むリアクティブシステムを宣言的に記述することができる.小規模組込みシステムの開発はマイクロコントローラなどの計算資源が限られた環境を対象としている.このような環境ではリソースの不足による実行時エラーを防ぐため静的にメモリ消費量を見積もる必要がある.提案する手法では遷移する状態の集合を静的に限定し,動的なメモリの確保を行うことなく実行時の計算の切り替えを実現させている.switch拡張の処理系は純粋なEmfrpへの変換器として実装されている.提案する拡張によって,状態に応じて振る舞いが動的に変化するコンポーネントの記述が容易になることを例を通して示す.

論文

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

Arimichi Matsumura, Takuo Watanabe
IPSJ 126th SIGPRO Workshop (SIGPRO126), National Institute of Informatics, Oct. 30-31, 2019.

Abstract

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.

Publication

関連リンク