Metaborgでオリジナル言語をJavaに閉じ込める

「文字列に自然言語しか書いてはいかん」というエントリを書いた後で,同じことを考えている人がいるのではないかと調べたら,あった.

Martin Bravenboer and Eelco Visser, Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions, OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications

JPanel panel = panel of border layout {
  hgap = 12 vgap = 12
  north = label "Please enter your message"
  center = scrollpane of textarea {
    rows = 20
    columns = 40
  }
  south = panel of border layout {
    east = panel of grid layout {
      hgap = 12 vgap = 12
      row = {
        button "Ok"
        button "Cancel"
      }
    }
  }
};

こんな風にJavaなんだけどGUIのデザインのような普通に書くとわずらわしいところを「俺言語」で書けるようだ

Metaborg - http://www.program-transformation.org/Stratego/MetaBorg

ただ,この文法を定義する方法がいまいちまだ読めていない(マニュアル解読中)