bison.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-bison" role="wrap">
  8. <?dbhtml filename="bison.html"?>
  9. <sect1info condition="script">
  10. <productname>bison</productname>
  11. <productnumber>&bison-version;</productnumber>
  12. <address>&bison-url;</address>
  13. </sect1info>
  14. <title>Bison-&bison-version;</title>
  15. <indexterm zone="ch-system-bison">
  16. <primary sortas="a-Bison">Bison</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Bison 软件包包含语法分析器生成器。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&bison-ch6-sbu;</seg>
  26. <seg>&bison-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Bison</title>
  32. <para>首先,解决当前版本构建系统中的一个问题:</para>
  33. <screen><userinput remap="pre">sed -i '6855 s/mv/cp/' Makefile.in</userinput></screen>
  34. <para>准备编译 Bison:</para>
  35. <screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
  36. <para>编译该软件包,但不能使用并行编译,
  37. 以躲避当前版本构建系统中的一个竞争条件:</para>
  38. <screen><userinput remap="make">make -j1</userinput></screen>
  39. <!--
  40. <para>To test the results (about 2.2 SBU), issue:</para>
  41. <screen><userinput remap="test">make check</userinput></screen>
  42. -->
  43. <para>在考虑测试的情况下, bison 和 flex 之间存在循环依赖。
  44. 如果希望的话,可以在下一节安装 flex 后,重新构建 bison 软件包,
  45. 再执行 <command>make check</command> 运行测试。</para>
  46. <para>安装该软件包:</para>
  47. <screen><userinput remap="install">make install</userinput></screen>
  48. </sect2>
  49. <sect2 id="contents-bison" role="content">
  50. <title>Bison 的内容</title>
  51. <segmentedlist>
  52. <segtitle>安装的程序</segtitle>
  53. <segtitle>安装的库</segtitle>
  54. <segtitle>安装的目录</segtitle>
  55. <seglistitem>
  56. <seg>bison 和 yacc</seg>
  57. <seg>liby.a</seg>
  58. <seg>/usr/share/bison</seg>
  59. </seglistitem>
  60. </segmentedlist>
  61. <variablelist>
  62. <bridgehead renderas="sect3">简要描述</bridgehead>
  63. <?dbfo list-presentation="list"?>
  64. <?dbhtml list-presentation="table"?>
  65. <varlistentry id="bison">
  66. <term><command>bison</command></term>
  67. <listitem>
  68. <!--para>Generates, from a series of rules, a program for analyzing the
  69. structure of text files; Bison is a replacement for Yacc (Yet Another
  70. Compiler Compiler)</para-->
  71. <para>根据一组规则,创建一个用于分析文本文件结构的程序;
  72. Bison 是 Yacc (Yet Another Compiler Compiler) 的替代品。
  73. </para>
  74. <indexterm zone="ch-system-bison bison">
  75. <primary sortas="b-bison">bison</primary>
  76. </indexterm>
  77. </listitem>
  78. </varlistentry>
  79. <varlistentry id="yacc">
  80. <term><command>yacc</command></term>
  81. <listitem>
  82. <para><command>bison</command> 的一个封装器,被那些仍然调用
  83. <command>yacc</command> 而非 <command>bison</command>
  84. 的程序使用,它使用 <parameter>-y</parameter> 选项调用
  85. <command>bison</command>。</para>
  86. <indexterm zone="ch-system-bison yacc">
  87. <primary sortas="b-yacc">yacc</primary>
  88. </indexterm>
  89. </listitem>
  90. </varlistentry>
  91. <varlistentry id="liby">
  92. <term><filename class="libraryfile">liby</filename></term>
  93. <listitem>
  94. <para>Yacc 库包含与 Yacc 兼容的 <function>yyerror</function>
  95. 和 <function>main</function> 函数实现;它并不是很有用,
  96. 但 POSIX 需要它</para>
  97. <indexterm zone="ch-system-bison liby">
  98. <primary sortas="c-liby">liby</primary>
  99. </indexterm>
  100. </listitem>
  101. </varlistentry>
  102. </variablelist>
  103. </sect2>
  104. </sect1>