このブログは、旧・はてなダイアリー「檜山正幸のキマイラ飼育記 メモ編」(http://d.hatena.ne.jp/m-hiyama-memo/)のデータを移行・保存したものであり、今後(2019年1月以降)更新の予定はありません。

今後の更新は、新しいブログ http://m-hiyama-memo.hatenablog.com/ で行います。

Katy記法

Katy(ケイティ)記法に関してもそのうち記述。とりあえず、インラインテーブル問題。


module Table
provides element table;
requires content td_content;
{
element table = <table>(tr*);
element tr = <tr>(td*);
element td = <td>(td_content);
}

module Par
provides element p;
requires collection more_inlines;
{
element p = <p>(#(em|more_inlines));
element em = <em>(#);
}

module Nested = rec{more_inlines}(
|-{table, more_inlines=table}Table<-{p, td_content=p}Par);

モジュールの定義は次のように書いても同じ。


module Par = mod[element p <= collection more_inlines]{
p = <p>(#(em|more_inlines)); element em = <em>(#); };

Katyは、モジュール定数、モジュール変数、モジュール演算からモジュール式を組み立てて、モジュール定義(モジュールの名前へのバインド)を行う言語。