Computer Software Article
多言語に対応した衛生的マクロ機構導入方式
高桑健太郎, 渡部卓雄
コンピュータソフトウェア, Vol. 35, No. 2, pp. 33-39,
日本ソフトウェア科学会,
DOI: 10.11309/jssst.35.2_33,
May, 2018.
本論文は日本ソフトウェア科学会第34回大会において発表され,査読の結果採択されたものである.
概要
OMetaで記述された言語処理系に対する,対象言語に依存しない衛生的マクロ機構の導入方式を提案する.OMetaは強力なパターンマッチ機構を備えたオブジェクト指向プログラミング言語であり,構文解析器などを作成するのに適している.提案方式は,Racketのマクロ機構で用いられているScope Setモデルに基づき,OMetaで記述されたプログラミング言語の構文解析器に衛生的マクロの定義構文および定義機構を導入するものである.本方式をJavascriptのサブセットおよびMinCamlの構文解析器に適用し,その有効性を確認した.
A Multi-Language Implementation Method for Hygienic Macro Definition Mechanisms
Kentaro Takakuwa & Takuo Watanabe
Computer Software, Vol. 35, No. 2, pp. 33-39,
Japan Society for Software Science and Technology,
DOI: 10.11309/jssst.35.2_33,
May, 2018 (in Japanese).
Abstract
In this paper, we propose an implementation method of hygienic macro-definition mechanisms into languages defined using OMeta, an OOP language with PEG-based general-purpose pattern matching. From the specification of a macro-definition mechanism and a parser written in OMeta, the proposed method generates an extended parser equipped with the macro-definition mechanism based on the Scoped Set model. We show the effectiveness of the method by applying it to two different languages: Javascript and MinCaml.