/usr/share/doc/HOWTO/ja-html/Lex-YACC-HOWTO-5.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
<TITLE>Lex and YACC primer/HOWTO: C++ $B$G$N9=J82r@O4o$N:n@.(B</TITLE>
<LINK HREF="Lex-YACC-HOWTO-6.html" REL=next>
<LINK HREF="Lex-YACC-HOWTO-4.html" REL=previous>
<LINK HREF="Lex-YACC-HOWTO.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="Lex-YACC-HOWTO-6.html">$B<!$N%Z!<%8(B</A>
<A HREF="Lex-YACC-HOWTO-4.html">$BA0$N%Z!<%8(B</A>
<A HREF="Lex-YACC-HOWTO.html#toc5">$BL\<!$X(B</A>
<HR>
<H2><A NAME="s5">5.</A> <A HREF="Lex-YACC-HOWTO.html#toc5">C++ $B$G$N9=J82r@O4o$N:n@.(B</A></H2>
<P>Lex $B$H(B YACC $B$O(B C++ $B$,EP>l$9$k0JA0$+$i$"$j$^$9$,!"(BC++ $B$G9=J82r@O4o$r:n(B
$B@.$9$k$3$H$b2DG=$G$9!#(BFlex $B$K$O(B C++ $B$N(B $B;z6g2r@O4o$r@8@.$9$k%*%W%7%g%s(B
$B$b$"$j$^$9$,!"(BYACC $B$NJ}$K$=$l$rD>@\07$&J}K!$,$J$$$N$G!"$3$3$G$O;HMQ$7(B
$B$^$;$s!#(B</P>
<P>$BI.<T$,(B C++ $B$N9=J82r@O4o$r:n$k:]$K9%$s$G;H$&J}K!$O!"(BLex $B$KIaDL$N(B C $B%U%!(B
$B%$%k$N;z6g2r@O4o$r=PNO$5$;$F!"(BYACC $B$K(B C++ $B$N9=J82r@O4o$r@8@.$5$;$k$d$j(B
$BJ}$G$9!#%"%W%j%1!<%7%g%s$r%j%s%/$7$?;~$K!"$3$NJ}K!$@$HLdBj$,$"$k>l9g(B
$B$,$"$j$^$9!#(BC++ $B$G$OL@<(E*$K(B extern "C" $B@k8@$7$J$$8B$j!"%G(B
$B%U%)%k%H$G$O(B C $B$N4X?t$r8+$D$1$i$l$J$$$+$i$G$9!#(B</P>
<P>$B$3$l$r2sHr$9$k$?$a$K$O!"(BYACC $B$G0J2<$N$h$&$J(B C $B%X%C%@$r:n$C$F$/$@$5$$!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
extern "C"
{
int yyparse(void);
int yylex(void);
int yywrap()
{
return 1;
}
}
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>yydebug $B$r@k8@$b$7$/$O!"JQ99$7$?$$>l9g$O$3$3$G0J2<$N$h$&$K9T$C$F$/$@$5(B
$B$$!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
extern int yydebug;
main()
{
yydebug=1;
yyparse();
}
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>$B$3$l$O!"(BC++ $B$N(B '$BDj5A$O0lEY(B' $B5,B'$N$?$a$KI,MW$G!"(Byydebug $B$NB?=EDj5A$rKI(B
$B$.$^$9!#(B</P>
<P>$B2C$($F!"(BC++ $B$G$O7?%A%'%C%/$,$h$j87$7$$$N$G!"(BYYSTYPE $B$N(B #define $B$r(B Lex
$B%U%!%$%k$KDI5-$7$J$$$H$@$a$+$b$7$l$^$;$s!#(B</P>
<P>$B%3%s%Q%$%k$9$k$K$O!"0J2<$N$h$&$K$7$F$/$@$5$$!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
lex bindconfig2.l
yacc --verbose --debug -d bindconfig2.y -o bindconfig2.cc
cc -c lex.yy.c -o lex.yy.o
c++ lex.yy.o bindconfig2.cc -o bindconfig2
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>-o $B;XDj$,$"$k$N$G!"(By.tab.h $B$O(B bindconfig2.cc.h $B$H$$$&L>A0$K$J$C$F$$$k(B
$B$3$H$K$bN10U$7$F$/$@$5$$!#(B</P>
<P>$B$^$H$a(B - $B;z6g2r@O4o$N%3%s%Q%$%k$O!"$o$6$o$6(B C++ $B$G$d$m$&$H$7$J$$$G(B C
$B$G$d$k$3$H!#9=J82r@O4o$O(B C++ $B$G:n$j!"(BC $B4X?t$r8F$S=P$7$?$$;~$O(B extern
"C" $BJ8$G%3%s%Q%$%i$K@k8@$9$k$3$H!#(B</P>
<HR>
<A HREF="Lex-YACC-HOWTO-6.html">$B<!$N%Z!<%8(B</A>
<A HREF="Lex-YACC-HOWTO-4.html">$BA0$N%Z!<%8(B</A>
<A HREF="Lex-YACC-HOWTO.html#toc5">$BL\<!$X(B</A>
</BODY>
</HTML>
|