%{ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "calc.h" %} %token NUM %left '-' '+' '*' '/' %% input: /* empty*/ | input line ; line: '\n' | exp '\n' { printf("%d\n", $1); } ; exp: NUM | exp '+' exp { $$ = $1 + $3; } | exp '-' exp { $$ = $1 - $3; } | exp '*' exp { $$ = $1 * $3; } | exp '/' exp { $$ = $1 / $3; } ; %%
yacc/lexã¨ã¯ Cã§ããã°ã©ãã³ã°è¨èªã®å¦çç³»ãå®è£ ããã®ã§ããã°ã å¤ãã®å ´åãyaccã¨lexã¨ãããã¼ã«ã使ãã¾ãã å®ã®ã¨ãããCã¨yacc/lexã§ç°¡åãªããã°ã©ãã³ã°è¨èªãä½ããã¨ããã®ã¯ã 以åããCè¨èªã¨ã¿è©± ãã§æ¸ããã é»åãä½ã£ã¦ã¿ããã ã®ç¼ãç´ãã«ãªãã¾ããyaccã¨lexã®èª¬æããã¡ãã«ç°¡åã«æ¸ããã®ã§ã ãã¡ããè¦ã¦ãã ããââã¨è¨ãããã¨ããã§ããã ã¾ãããã§ã軽ã説æãã¾ãã å 容çã«ã¯éè¤ãã¨ãããã³ãããã¦ããé¨åãããã¾ããã ããã°ã©ãã³ã°è¨èªã®å¦çç³»ã¯ãé常ã以ä¸ã®ãããªæé ãåãã¾ãã åå¥è§£æ ã½ã¼ã¹ããã°ã©ã ãããåå¥(ãã¼ã¯ã³)ãã®ä¸¦ã³ã«åå²ããå¦çã§ãã æ§æ解æ ãã¼ã¯ã³ã®ä¸¦ã³ããã解ææ¨ãæ§ç¯ããå¦çã§ãã ãã®å¾ãCãªã©ã®æ©æ¢°èªãåãã³ã³ãã¤ã©ã Javaã®ãããªãã¤ãã³ã¼ããåãã³ã³ãã¤ã©ãªãã ãã³ã¼ãçæãã¨ããå¦ç
åå¥ã¹ãã£ãçæããã°ã©ã Flex 2.3.7ã1.03ç 1993å¹´2æ G. T. Nicol è åº ããã°ã©ã ã®å®ä¾ã«ã¤ã㦠Flexå ¥é åé¡è§£æ±ºæ段ã¨ãã¦ã®Flex ä¸è¬çãªããã°ã©ãã³ã°ã»ãã¼ã«ã¨ãã¦ã®Flex Flexã®èµ·å ã³ãã³ãã©ã¤ã³ã»ãªãã·ã§ã³ ã³ãã³ãã©ã¤ã³ã»ãªãã·ã§ã³ï¼Flex 2.5ã®è£è¶³æ å ±ï¼ Flexè¨è¿°è¨èª ã³ã¡ã³ã ãªãã·ã§ã³ã®Cã³ã¼ã å®ç¾© %% ã«ã¼ã« ãã¿ã¼ã³ã»ã»ã¯ã·ã§ã³ æå Flexã«ãããæåå Flexã«ãããæåã®ã°ã«ã¼ãå Flexã«ãããæåã®ã°ã«ã¼ãåï¼Flex 2.5ã®è£è¶³æ å ±ï¼ æ£è¦è¡¨ç¾ ã¹ã¿ã¼ãç¶æ ã¹ã¿ã¼ãç¶æ ã®èª¬æ ç¶æ ã®æ´»æ§å ã¹ã¿ã¼ãç¶æ ã«é¢ãã注 ã¹ã¿ã¼ãç¶æ ã«é¢ãã注ï¼Flex 2.5ã®è£è¶³æ å ±ï¼ ã¹ã¿ã¼ãç¶æ ã®ä½¿ç¨ä¾ %optionï¼Flex 2.5ã®è£è¶³æ å ±ï¼ Flexã¨ã®ã¤ã³ã¿ã¼ãã§ã¤ã¹ Flexã¨C F
PowerDNS BV (bert hubert <bert@powerdns.com>) v0.8 $Date: 2002/07/22 14:02:09 $ 大西 大樹 (daiki onishi <[email protected]>) v0.8j 2003/02/08 æ¬ããã¥ã¡ã³ã㯠Lex 㨠YACC ã®åºæ¬çãªä½¿ãæ¹ã«ã¤ãã¦è¨è¿°ãã¾ã 1. ã¤ã³ãããã¯ã·ã§ã³ 1.1 æ¬ããã¥ã¡ã³ãã«å«ã¾ããªããã® 1.2 ãã¦ã³ãã¼ã 1.3 ã©ã¤ã»ã³ã¹ã«ã¤ã㦠2. Lex 㨠YACC ã§ã§ããã㨠2.1 ããããã®ããã°ã©ã ã®ãã£ã¦ããã㨠3. Lex 3.1 æ£è¦è¡¨ç¾ã§ã®ããã 3.2 C ã®ãããªã·ã³ã¿ãã¯ã¹ããã¤ããå°ãé«åº¦ãªä¾ 3.3 ãããã 4. YACC 4.1 åç´ãªæ¸©åº¦èª¿ç¯å¨ 4.2 å¼æ°ãæ±ããããã«æ¡å¼µããã温度調ç¯å¨ 4.3 è¨å®ãã¡ã¤ã«ã®æ§æ解æ
ãã®ãã¼ã¸ã®ç®çã¯ããç¬èªã®ããã°ã©ãã³ã°è¨èªãä½ãããã¨ã§ãã ãããã°ã©ãã³ã°è¨èªãä½ããã¨ããã®ã¯ã ãã£ããã¨ã®ãªãæ¹ããããã°ãããã¶ãç¡è¬ãªç®æ¨ã«è¦ããã®ããããã¾ããã ã§ããããã¤ãã®åºç¤ç¥èããä¿®å¾ããã°ãæè¡çã«ã¯ã å®ã¯ãããªã«é£ãããã®ã§ãããã¾ããã ã ã£ãããã²ã¨ã¤ãããä½ã£ã¦ã¿ããã¨æãã¾ããã? ãªã«ããããã°ã©ãã³ã°è¨èªãä½ããªãã¦ã ããã«ããã£ãè¯ãããããªãã§ããã ç§ã¯ä½ã£ã¦ã¿ããã¨æãã¾ãããã ããä½ãã¾ãã ããã°ã©ãã³ã°è¨èªãªãã¦ããå±±ã»ã©ããã®ã«ã ä»ããæ°ããè¨èªãªãã¦ä»ã足ãã¦ä½ãããããã ã! ãªã©ã¨ããããã³ãã¯å ¥ãã¦ã¯ããã¾ããã ããªãããã°ã©ãã³ã°è¨èªãªããä½ããã§ãã?ã ã¨èããããããã®ç㯠ããã«yaccãããããã ã ã§å åã ããã¨ç§ã¯æãã¾ã(yaccãä½ãã¯å¾è¿°ãã¾ã)ã ã¨ããããã§ââ ãã ç§ãªãããæ°è¨èªã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}