鴨川に水没するブログ

経験した出来事やら何か思い付いたことやらを適当にだらだら書いてます(の予定です)

せんべいを割る - はてな記法勉強してみた。

せんべいを割るプログラム。改行はLFで。

                      #include<stdio.h>
                  char*s="&p(x/""){putc'@"
                "(x,stdout);/""}q(x)$!1{for('<"
            "i=48;i<x;i++)p/""(32);}main(){cha':"
          "r&*c;q(70);print/""f(_#incl_$!2_ude_);q'7"
       "(t);printf(_<stdio.h/"">_);p(&10);q(66);prin'6"
      "tf(_char_$!3_*s=_);p(34/"");for(c=s;*c>0;c++){'4"
    "p&(*c);if(*c==39){c++;p(*/""$!4c);p(34);p(10);q(*'3"
   "c);p(34);}else& if(*c==47){/""p(34);q(t$!6);p(34);}'2"
  "}p(34);p(59);printf(&_int i/"",t=%d;_,t+5);for$!7(c='1"
 "s;*c>0;c++){if(*c==33){c&++;q/""(*c);}else if(*c==$!:36'0"
")p(10);else if(*c==95&)p(34);el/""se if(*c==38$!<){q(t);}'0"
"else if(*c==&39){c++;continue$!@;}/""else if(*c==47)&conti'0"
"nue;$!Helse{p(&*c);}}}$";int i,t=51;p(x){putc(x,stdout);}q(x)
 {for(i=48;i<x;i++)p(32);}main(){char*c;q(70);printf("#incl"
  "ude");q(t);printf("<stdio.h>");p(10);q(66);printf("char"
   "*s=");p(34);for(c=s;*c>0;c++){p(*c);if(*c==39){c++;p(*
    c);p(34);p(10);q(*c);p(34);}else if(*c==47){p(34);q(t
      );p(34);}}p(34);p(59);printf("int i,t=%d;",t+5);for
       (c=s;*c>0;c++){if(*c==33){c++;q(*c);}else if(*c==
          36)p(10);else if(*c==95)p(34);else if(*c==38
            ){q(t);}else if(*c==39){c++;continue
                ;}else if(*c==47)continue;
                        else{p(*c);}}}

これが

                      #include   <stdio.h>
                  char*s="&p(x/"   "){putc'@"
                "(x,stdout);/"   "}q(x)$!1{for('<"
            "i=48;i<x;i++)p/"   "(32);}main(){cha':"
          "r&*c;q(70);print/"   "f(_#incl_$!2_ude_);q'7"
       "(t);printf(_<stdio.h/"   ">_);p(&10);q(66);prin'6"
      "tf(_char_$!3_*s=_);p(34/"   ");for(c=s;*c>0;c++){'4"
    "p&(*c);if(*c==39){c++;p(*/"   "$!4c);p(34);p(10);q(*'3"
   "c);p(34);}else& if(*c==47){/"   "p(34);q(t$!6);p(34);}'2"
  "}p(34);p(59);printf(&_int i/"   ",t=%d;_,t+5);for$!7(c='1"
 "s;*c>0;c++){if(*c==33){c&++;q/"   "(*c);}else if(*c==$!:36'0"
")p(10);else if(*c==95&)p(34);el/"   "se if(*c==38$!<){q(t);}'0"
"else if(*c==&39){c++;continue$!@;}/"   "else if(*c==47)&conti'0"
"nue;$!Helse{p(&*c);}}}$";int i,t=56;   p(x){putc(x,stdout);}q(x)
 {for(i=48;i<x;i++)p(32);}main(){char   *c;q(70);printf("#incl"
  "ude");q(t);printf("<stdio.h>");p(   10);q(66);printf("char"
   "*s=");p(34);for(c=s;*c>0;c++){p   (*c);if(*c==39){c++;p(*
    c);p(34);p(10);q(*c);p(34);}else    if(*c==47){p(34);q(t
      );p(34);}}p(34);p(59);printf(   "int i,t=%d;",t+5);for
       (c=s;*c>0;c++){if(*c==33){c   ++;q(*c);}else if(*c==
          36)p(10);else if(*c==95   )p(34);else if(*c==38
            ){q(t);}else if(*c==   39){c++;continue
                ;}else if(*c==47)   continue;
                        else{p(   *c);}}}

こうなって

                      #include        <stdio.h>
                  char*s="&p(x/"        "){putc'@"
                "(x,stdout);/"        "}q(x)$!1{for('<"
            "i=48;i<x;i++)p/"        "(32);}main(){cha':"
          "r&*c;q(70);print/"        "f(_#incl_$!2_ude_);q'7"
       "(t);printf(_<stdio.h/"        ">_);p(&10);q(66);prin'6"
      "tf(_char_$!3_*s=_);p(34/"        ");for(c=s;*c>0;c++){'4"
    "p&(*c);if(*c==39){c++;p(*/"        "$!4c);p(34);p(10);q(*'3"
   "c);p(34);}else& if(*c==47){/"        "p(34);q(t$!6);p(34);}'2"
  "}p(34);p(59);printf(&_int i/"        ",t=%d;_,t+5);for$!7(c='1"
 "s;*c>0;c++){if(*c==33){c&++;q/"        "(*c);}else if(*c==$!:36'0"
")p(10);else if(*c==95&)p(34);el/"        "se if(*c==38$!<){q(t);}'0"
"else if(*c==&39){c++;continue$!@;}/"        "else if(*c==47)&conti'0"
"nue;$!Helse{p(&*c);}}}$";int i,t=61;        p(x){putc(x,stdout);}q(x)
 {for(i=48;i<x;i++)p(32);}main(){char        *c;q(70);printf("#incl"
  "ude");q(t);printf("<stdio.h>");p(        10);q(66);printf("char"
   "*s=");p(34);for(c=s;*c>0;c++){p        (*c);if(*c==39){c++;p(*
    c);p(34);p(10);q(*c);p(34);}else         if(*c==47){p(34);q(t
      );p(34);}}p(34);p(59);printf(        "int i,t=%d;",t+5);for
       (c=s;*c>0;c++){if(*c==33){c        ++;q(*c);}else if(*c==
          36)p(10);else if(*c==95        )p(34);else if(*c==38
            ){q(t);}else if(*c==        39){c++;continue
                ;}else if(*c==47)        continue;
                        else{p(        *c);}}}

こんな感じになっていく。