Diksam
Diksamã®ææ³ä¸è¦§ã§ããJava, C++, C#çã®è¨èªãããç¨åº¦ç¥ã£ã¦ãã人ã¯ãããèªãã°Diksamã®åºç¤ããã¹ã¿ã¼ãã¦Diksamãæ¸ããã¨ãã§ããããã«ãªã£ã¦ãã¾ããââã¯ãã便ä¹ã§ãããªã«ããã¯ã¦ãã®ãããã®äººæ°è¨äºãåºç¤ææ³æéãã¹ã¿ã¼ã ããã«ãªã£ã¦ããâ¦
ä»äººã®æè¦ã®ç¿»è¨³ã°ããã§ãã¢ã¬ãªã®ã§ãä¾å¤å¦çæ©æ§ã«ã¤ãã¦ã®ç§ã®èãæ¹ã¯ãDiksamããããªã£ã¦ããããã«ã ä¾å¤å¦çæ©æ§èªä½ã¯å¿ è¦ æ¤æ»ä¾å¤ãå¿ è¦ ã¨ãããã®ã§ãã
ã«ã¡ãããé ãæ©ã¿ã§ãããã¡ããDiksamã¯æ©è½è¿½å ãç¶ãã¦ããã®ã§ããã¾ã«ã¯è¨èªã®è©±ããJavaãC#ã«ã¯ãç¶æ¿ããªã¼ã®æä¸ä½ã¯ã©ã¹ã¨ãã¦ãObjectãããã¾ããåãªãè¨èªã«ãããã¦ãã¯åæ§ã®ã¯ã©ã¹ãããã¾ããã C++ã«ã¯ããã¾ããããããã¯ãtemplate(â¦
ãã¤ã¾ã§ãã¨ãã²ã®è©±ãä¸ãã£ã¦ããã®ãä½ãªã®ã§ãDiksamã®ç¾ç¶å ±åãªã©ãç¾å¨ã®Diksamã§ã¯ãããã§æ¸ããããã«ãã¦ã¤ã³ãã¦ãéãã¦æåãç·çã®å³å½¢ãç»åã表示ãããã¨ãã§ãã¾ãã ããã°ã©ãã³ã°è¨èªãä½ã/Diksam on Windowsãã ãå®ç¨ä¸ã¯ãã¿ã³ã®â¦
Diksamã®ãã°ãã£ãã¯ã¹ã®ãããver.0.4.03ãå ¬éãã¾ãããhttp://kmaebashi.com/programmer/devlang/diksam_on_windows.htmlä¿®æ£ç¹ã¯ä»¥ä¸ã®2ç¹ã§ãã æåãªãã©ã«ã«é¢ãããã°ã§é åç ´å£ãèµ·ããã¦ããåé¡ãä¿®æ£ã http://kmaebashi.com/bbs/list.php?boâ¦
ããã¾ãã¦ããã§ã¨ããããã¾ããä»å¹´ããããããé¡ããããã¾ããããã¯ãã¦ãããæ²ç¤ºæ¿ã®æ¹ã§ãDiksamã®UNIXçã®EUCãã¼ã¸ã§ã³ããVine Linux 4.2ã¨MacOS Xã«ã¦æ£å¸¸åä½ããªããã¨ã®è©±ãåºã¦ãã¾ããhttp://kmaebashi.com/bbs/list.php?boardid=kmaebasâ¦
Diksamãå¾®å¦ã«ä¿®æ£ãã¾ããã®ã§ãver.0.4.02ãå ¬éãã¾ãããhttp://kmaebashi.com/programmer/devlang/diksam_on_windows.htmlä¿®æ£ç¹ã¯ä»¥ä¸ã®2ç¹ã§ãã Windowsçã«ã¦ã0x5Cåé¡ã®å¯¾å¿ãæãã¦ããã®ã§(_o_)ã追å ã UNIXçã«ã¦ãUTF-8çã追å ã ãã¾ã©ãâ¦
Webãµã¤ãã®ã»ãã§ãDiksamã®æ°ãã¼ã¸ã§ã³ããDiksam on Windowsããå ¬éãã¾ãããããã°ã©ãã³ã°è¨èªãä½ã/Diksam on Windowsããã¯ãDiksamã«ãã¦ã¤ã³ãã¦ãéãããç´ç·ãå弧ããããããããæç»ããããã¼ãã¼ãããã¦ã¹ã®ã¤ãã³ããæ¾ãæ©è½ãå ãâ¦
æãã¦ã¯ã³ã¢ã¼ãã§ããWindowsã®API(GDI)ã§ãããã¼ãã¼ã«ã¨ãã§ããè¦ããã©ãã¼ãã³ãããå®ç¾ããã«ã¯ã©ãããã°ãããã§ãããããã©ãã¼ãã³ãã¨ããã°XORãããã«ã¯SetROP2()ãã¨ããã¨ããã¾ã§ã¯ããã«ããã£ãã®ã§ãããã©ãã¼ãã³ãã®ç·ã®è²ãå¶å¾¡â¦
大æãN-BASICã¨ãã§ãæç»è²ãæå®ããã¨ãã«ã¯ãCOLORæã§æå®ããã¨ä»¥å¾ã®æç»ã¯å ¨é¨ãã®è²ã«ãªã£ã¦ãã¨æãã¾ããããã®æ¹æ³ãªããLINEæã§ãã¡ãã¡è²ãæå®ããå¿ è¦ããªãããã§ãããã¯ããã§ã²ã¨ã¤ã®æ¹æ³ã ã¨æãã¾ããâ¦â¦ããããããããã¢ã¼ãã«ãâ¦
Diksamã«ã¯ãè¤æ°ã½ã¼ã¹ãã¡ã¤ã«ã«ã¾ãããã°ãã¼ãã«å¤æ°ã¯ããã¾ããã ããã¯ç§ã¯åé¡ãªãã¨æã£ã¦ãã¾ããã°ãã¼ãã«å¤æ°èªä½ããããªã«ä½¿ç¨ã奨å±ããããã®ã§ã¯ãªããæ°ãå°ãªãã ããããget_xxx()ãset_xxx()é¢æ°ãä½ãã°ããã ããã¨ãCã§è¨ãstdinâ¦
ããã¶ãé·ããã¨ããã£ã¦ãã¾ãã¾ããã2ã¶æã¶ãã®æ«å®å ¬éã§ããUNIXçï¼ http://kmaebashi.com/programmer/devlang/diksam_unix_20081026.tgzWindowsçï¼ http://kmaebashi.com/programmer/devlang/diksam_win_20081026.tgzãã«ãã¤ã³ã¹ã¯ãªããã«ããåâ¦
Diksamã®æ§æè¦åã«ããã¦ãé¢æ°å¼ã³åºãã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã primary_expression LP argument_list RPã¤ã¾ããå¼ã®å¾ãã«ãæ¬å¼§ã§å²ãã å¼æ°ä¸¦ã³ãä»ãå ãããã®ãé¢æ°å¼ã³åºãã§ã(LP, RPã¯ããããleft paren, right parenã§ãã(ãã¨ã)ããæâ¦
ã¾ãæ«å®å ¬éã§ããUNIXçï¼ http://kmaebashi.com/programmer/devlang/diksam_unix_20080825.tgz Windowsçï¼ http://kmaebashi.com/programmer/devlang/diksam_win_20080825.tgz ãã¦ã³ãã£ã¹ããä»ãã¾ããã C#風ã®ä¾å¤å¦çæ©æ§ãä»ãã¾ããã ãã¦ã³ãâ¦
ã³ã¡ã³ããããã ããã®ã§ãããé·ããªãããã§ãã®ã§ã¨ã³ããªã§ãè¿äºãã¾ããhayashiããï¼ æè¿flex+bisonã使ã£ãè¨èªå¦çç³»ãä½ãåå¼·ãå§ãã¾ãã¦ãdiksamãããã£ã¦åå¼·ããã¦ããã ãã¦ã¾ãã ããã¯å æ ã§ãã ãµã¨ããããè¦ã¦ã¦æã£ããã¨ãªã®ã§â¦
ã¾ãæ«å®å ¬éã§ããUNIXç: http://kmaebashi.com/programmer/devlang/diksam_unix_20080512.tgz Windowsç: http://kmaebashi.com/programmer/devlang/diksam_win_20080512.tgzæ¬æ¥ãªãã¡ããã¨è¨èªä»æ§ãææ¸åãã¹ãã¨ããã§ãããæ¥ã ã©ãã°ããã¦ã¾ãã¦â¦
æ¢ã«å¿ãå»ããã¦ãããããªæ°ããã¾ãããDiksamã¯ä¸å¿ç´°ã ã¨ä½æ¥ãé²ãã¦ãã¾ãããå æ¥ã *1ï¼â¦ã«ã¯è¦ããªãããããã¾ããããä¸å¿é ã ã¨ãã¦é²ãã§ã¯ããã®ã§ãã®ãã¡å ¬éãã¾ããããã¨ãé ãã¨ãé£ä¼æãã«ã¯ã ãªãã¦ãã¨ãæ¸ãã¦ãã¾ã£ãã®ãããã¾â¦
以å http://d.hatena.ne.jp/kmaebashi/20071031#p1 ã«ã¡ã¢ã ãæ¸ãã件ãããã¡ãã£ã¨ã¡ããã¨æ¸ãã¾ããåä¸ç¶æ¿ããèããªãã®ã§ããã°ãããªã¢ã«ãã£ãºã ã¯ããªãã¸ã§ã¯ããã¨ã«é¢æ°ã¸ã®ãã¤ã³ã¿*1ã®é å(ä¿ã«è¨ãvtable)ã¸ã®ãã¤ã³ã¿ãæãããã°ãããâ¦
ç ãã®ã§ç°¡åã«ã¡ã¢ã ãæ¸ãã¾ããã åä¸ç¶æ¿ããèããªãã®ã§ããã°ãããªã¢ã«ãã£ãºã ã¯ããªãã¸ã§ã¯ããã¨ã«é¢æ°ã¸ã®ãã¤ã³ã¿*1ã®é å(ä¿ã«è¨ãvtable)ã¸ã®ãã¤ã³ã¿ãæãããã°ããã®ã§ãã(ãã®ã¸ãã®è©±ã¯ä»¥åãã¡ãã¨ããJavaè¬+è½ã¨ãç©´å¾¹åºè§£æãã«â¦
æè¿ãã«ãã´ãªã[éè¨]ã°ã£ããã§ãã©ãããããã°ã©ãã³ã°è¨èªãä½ãæ¥è¨ããªãã ãããããªãç¶æ³ãªã®ã§ã C++, Java, C#ã¨ãã§ã¯ãã³ã³ã¹ãã©ã¯ã¿ã¯ã¯ã©ã¹ã¨ååã®ã¡ã½ããã§ããµãã¯ã©ã¹ã«ç¶æ¿ããããã¨ã¯ããã¾ããã Diksamã§ã¯ã p = new Point.creâ¦
ä¹ ã ã«è¨èªè©±ãããããªå®£è¨ããã£ãã¨ãã Hoge a;Hogeãåºã¦ããæç¹ã§ã¯ããããã¯ã©ã¹åã ãå¤æ°åã ãé¢æ°åã ãåºå¥ãä»ãã¾ããã Hoge[] a;ã ã¨ãHoge[ã¾ã§è¦ã¦ãåºå¥ã§ããªãã®ã§ãä½ãèããã«ææ³ãæ¸ãã¨yaccã¯conflictãåºãã¾ãã Cã§ã¯ããtyâ¦
ãã¼ããã£ã¨åå²ã³ã³ãã¤ã«ãã¾ã¨ãã«åãã¾ãã⦠ä¼ç¤¾ã®ä»äºãå¿ãããã¾ãæéãåããªãã£ãã®ãããã¾ãããããã«ãã¦ããæã£ã以ä¸ã«æéãããã£ã¦ãã¾ããã ãããã¶ã¤ã³ããã£ã¨ã¡ããã¨ãããã¨ãJoel on Softwareã«æ¸ãã¦ãã£ããããªæ°ããã¾â¦
Javaã¨ãã§ã¡ã½ãããæ¸ãã¨ãã public static HogeHoge getHogeHoge() { ⦠}ã¿ãããªå½¢ã«ãªãããã§ããã®ä¸ã§ãã£ã¨ã注ç®ãããã¹ãã¯ã¡ã½ããåã§ããgetHogeHogeã§ããã¯ããªã®ã«ããããããã¶ãå¾ãã®ã»ãã«åããã¦ãã¾ã£ã¦ããã®ãæ°ã«å ¥ããªããâ¦
ããã°ã©ã ãæ¸ãã«ããã£ã¦ãã移æ¤æ§ãé«ããããã¨ã°ããã«#ifdefã使ã£ã¦ãããããªãã·ã³ãã¨ã®ã³ã¼ããåå¥ã«æ¸ãã®ã¯æããªãã¨ã ãã¨ããã®ã¯ã常èã¨è¨ã£ã¦ããã¨æãããããã°ã©ãã³ã°ä½æ³ãã«ãæ¸ãã¦ããã(p.272ãã)ã ã¨ããããã§crowbarã«â¦
2æ¥ã»ã©ç ä¿®ã§æ±äº¬è¡ã£ã¦ã¾ããããããªã¨ãã«Diksamã®OOã®ä»æ§ãå°ã èããã®ã§ã¡ã¢ã ã¾ããããã¯åã ããèãã¦ãããã¨ã§ãããç¶æ¿ã«ã¤ãã¦ã abstractãªã¯ã©ã¹ä»¥å¤ã¯ç¶æ¿ä¸å¯ ã¡ã½ããã¯ããã©ã«ãã§non virtual ã¢ã¯ã»ã¹ä¿®é£¾åã¯publicã¨privateããâ¦
ã¡ããéã空ãã¾ãã ä»äºã§å¸°ããé ããªãããã¤ããªãã¨ãããã¹ãã¬ã¹ãã«ãªç¶æ ã ã¨ãã¤ãã¤ã飲ãã§å¸°ã£ã¡ããã®ã§â¦ ããã¯ãã¦ããã Diksamã§ããã¤ã¾ã§ã1è¡ç®ã« int print(string str);ã¨ãæ¸ãã¦ãã®ãã¢ã¬ãªã®ã§ãã½ã¼ã¹ãã¡ã¤ã«ãåå²ããæ¹æ³â¦
ä¸å¿å§ããã°ãããªã®ã§ç¶ãã¦æ¸ãã¦ã¿ã ç¾è¡ã®Diksamã§ã¯åå²ã³ã³ãã¤ã«ãåºæ¥ãªãã®ã§ãããCã§æ¸ããããã¤ãã£ãé¢æ°ã(ã²ã¨ã¤ã ã)åå¨ããããã使ãã«ã¯Cã®ãããã¿ã¤ã宣è¨ãããã宣è¨ããªããã°ãªãã¾ããã int print(string str);ãªãã ä»æãâ¦