YACC(1)		UNIX¥³¥Þ¥ó¥É		YACC(1)

 [Ì¾Á°]
yacc - ¹½Ê¸²òÀÏ½èÍýÀ¸À®¥×¥í¥°¥é¥à

 [·Á¼°]
yacc [-w] [-vd] ¥Õ¥¡¥¤¥ë

 [µ¡Ç½ÀâÌÀ]
yacc¤Ï¡¢context-freeÊ¸Ë¡¤òLR(1)¹½Ê¸¥¢¥ë¥´¥ê¥º¥à¤ò¼Â¹Ô¤¹¤ë´Ê°×¥ª¡¼¥È¥Þ¥È¥ó¥Æ¡¼¥Ö¥ë¤ËÉ½¤·¤Þ¤¹¡£Ê¸Ë¡¤Ï¤¢¤¤¤Þ¤¤¤Ç¤¹¤¬¡¢Í¥Àè½ç°Ì¤ò»ØÄê¤·¤Æ¡¢¤¢¤¤¤Þ¤¤¤µ¤òÇÓ½ü¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

½ÐÎÏ¥Õ¥¡¥¤¥ëy.tab.c¤Ï¡¢C¥³¥ó¥Ñ¥¤¥é¤Ë¤è¤êyyparse¥×¥í¥°¥é¥à¤òÀ¸À®¤µ¤ì¤Þ¤¹¡£¤³¤Î¥×¥í¥°¥é¥à¤Ï»ú¶ç²òÀÏ¥×¥í¥°¥é¥àyylex¡¢mainÊÂ¤Ó¤Ë¥¨¥é¡¼½èÍý¥ë¡¼¥Á¥óyyerror¤Ê¤É¤È¶¦¤Ë¥í¡¼¥Ç¥£¥ó¥°¤µ¤ì¤Ê¤±¤ì¤Ð¡¢¤Ê¤ê¤Þ¤»¤ó¡£¤³¤ì¤é¤Î¥×¥í¥°¥é¥à¤Ï¡¢¥æ¡¼¥¶¤¬ÍÑ°Õ¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤·¤«¤·¡¢»ú¶ç²òÀÏ¥ë¡¼¥Á¥ó¤òÀ¸À®¤¹¤ëLex(1)¤ò»È¤¦¤ÈÊØÍø¤Ç¤¹¡£

-w¤ò»ØÄê¤¹¤ë¤È¡¢ÆüËÜ¸ìÂÐ±þyacc(/usr/nje/bin/yacc)¤¬µ¯Æ°¤µ¤ì¤Þ¤¹¡£
Ì¤»ØÄê¤Î¾ì¹ç¤ÏÄÌ¾ï¤Îyacc(/usr/bin/yacc)¤¬µ¯Æ°¤µ¤ì¤Þ¤¹¡£

-v¤ò»ØÄê¤¹¤ë¤È¡¢¥Ñ¡¼¥·¥ó¥°¥Æ¡¼¥Ö¥ë¤È¤¢¤¤¤Þ¤¤¤ÊÊ¸Ë¡¤Ë¤è¤ë'Ì·½â'¤Î¾ðÊó¤¬¡¢y.output¤È¤·¤Æ½ÐÎÏ¤µ¤ì¤Þ¤¹¡£

-d¤ò»ØÄê¤¹¤ë¤È¡¢¥æ¡¼¥¶¤¬»ØÄê¤·¤¿¥È¡¼¥¯¥óÌ¾¤È¤½¤ì¤Ëyacc¤¬¥¢¥µ¥¤¥ó¤·¤¿¥È¡¼¥¯¥ó¥³¡¼¥É¤òÄêµÁ¤·¤¿y.tab.h¤ò½ÐÎÏ¤·¤Þ¤¹¡£¤³¤ì¤Ë¤è¤êy.tab.c°Ê³°¤«¤é¤Î¥È¡¼¥¯¥ó¥³¡¼¥É¤Î»ÈÍÑ¤¬²ÄÇ½¤È¤Ê¤ê¤Þ¤¹¡£

 [¥Õ¥¡¥¤¥ë]
y.output
y.tab.c
y.tab.h 	¥È¡¼¥¯¥óÌ¾/¥³¡¼¥É¤ÎÄêµÁ
yacc.tmp¡¡yacc.act	°ì»þ¥Õ¥¡¥¤¥ë
/usr/lib/nje/yaccpar	¥Ñ¡¼¥µ¥×¥í¥°¥é¥à¤Î¥×¥í¥È¥¿¥¤¥×

 [ÆüËÜ¸ìµ¡Ç½]
¡¡
a) ¥È¡¼¥¯¥ó¾ðÊó(¥·¥ó¥°¥ë¥¯¥©¡¼¥È¤µ¤ì¤¿Ê¸»ú¤Î¤ß)¤Ë¡¢ÆüËÜ¸ì¥Ç¡¼¥¿¤¬»ÈÍÑ²ÄÇ½¡£

b) 1¥¹¥¯¥ê¥×¥ÈÆâ¤Ç¡¢Ç¤°Õ¤Î1000¼ïÎà¤ÎEUCÊ¸»ú¤¬»ÈÍÑ²ÄÇ½¡£

 [´ØÏ¢»ö¹à]
LEX(1)
LR Parsing by A.V.Aho and S.C.Johnson,Computing Surveys,June 1974.YACC-Yet Another Compiler Compiler by S.C.Johnson.

 [¿ÇÃÇµ¡Ç½]
reduce-reduce ¤Èshift-reduce¤ÎÌ·½â¿ô¤òÉ¸½à½ÐÎÏ¤Ë½ÐÎÏ¤µ¤ì¤Þ¤¹¡£¤µ¤é¤Ë¾Ü¤·¤¤¾ðÊó¤Ï.y.output¤Ë½ÐÎÏ¤µ¤ì¤Þ¤¹¡£²ò¼áÉÔ²ÄÇ½¤Ê¥ë¡¼¥ë¤¬¤¢¤Ã¤¿¾ì¹ç¤âÆ±ÍÍ¤Ç¤¹¡£

 [Ãí°Õ»ö¹à]
yacc¤Ï½ÐÎÏ¥Õ¥¡¥¤¥ëÌ¾¤¬¸ÇÄê¤Ç¤¢¤ë¤¿¤á¡¢Æ±°ì¥Ç¥£¥ì¥¯¥È¥êÆâ¤Ç¤ÏÆ±»þ¤Ë°ì²ó¤·¤«½èÍý¤Ç¤­¤Þ¤»¤ó¡£
ÆüËÜ¸ì¤«µ¡Ç½¤ÎÃí°Õ»ö¹à¤Ï°Ê²¼¤Î¤È¤¦¤ê¤Ç¤¹¡£
  a) ÂÐ¾Ý¥³¡¼¥É·Ï¤Ï¡¢EUC¡¢ASCII¡¢È¾³Ñ¥«¥Ê¤Ç¤¹¡£

  b) EUCÊ¸»ú¤Ïyyparse()Æâ¤Ç¤Ï¡¢ÆâÉô¥³¡¼¥É¤ËÊÑ´¹¤µ¤ì¤ë¤Î¤Ç¡¢yyparse()¤òÊÑ¹¹¤¹¤ëºÝ¤Ë¤ÏÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

  c) ½ÐÎÏ¥³¡¼¥É¤ò¥ê¥ó¥¯¤¹¤ë¤È¤­¤Ï¡¢É¬¤ºÆüËÜ¸ì²½¥é¥¤¥Ö¥é¥ê(libnjeJ.a)¤ò»ÈÍÑ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡