C99 には digraph というものがあるそうだ
%: が # になるということなので、C99 と PostScript の Polyglot はこういう風にも書ける。
%:include<stdio.h> %:if 0 (Hello, world!)= ( %:else int main() { puts("Hello, world!"); return 0; } %:endif %:if 0 ) pop %:endif
PostScript で色付け
%:include<stdio.h> %:if 0 (Hello, world!)= ( %:else int main() { puts("Hello, world!"); return 0; } %:endif %:if 0 ) pop %:endif
Erlang あたりにも応用できそう。
追記: Erlang と C99 で Hello world
%:if 0 -module(hw). -export([main/0]). main()->io:format("Hello, world!"),true %:else %:include<stdio.h> %:define orelse int orelse main() <% puts("Hello, world!"); return 0; %>/* 0.%*/ %:endif