bison-desc.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <sect2>
  2. <title>Contents of bison-&bison-contversion;</title>
  3. <sect3><title>Program Files</title>
  4. <para>bison and yacc</para></sect3>
  5. <sect3><title>Descriptions</title>
  6. <sect4><title>bison</title>
  7. <para>Bison is a parser generator, a replacement for YACC. YACC stands for Yet
  8. Another Compiler Compiler. What is Bison then? It is a program that
  9. generates a program that analyzes the structure of a text file. Instead of
  10. writing the actual program a user specifies how things should be connected
  11. and with those rules a program is constructed that analyzes the
  12. text file. There are a lot of examples where structure is needed and
  13. one of them is the calculator.</para>
  14. <para>Given the string :</para>
  15. <blockquote><literallayout> 1 + 2 * 3</literallayout></blockquote>
  16. <para>A human can easily come to the result 7. Why? Because of the structure.
  17. Our brain knows
  18. how to interpret the string. The computer doesn't know that and Bison
  19. is a
  20. tool to help it understand by presenting the string in the following way
  21. to the compiler:</para>
  22. <blockquote><literallayout> +
  23. / \
  24. * 1
  25. / \
  26. 2 3</literallayout></blockquote>
  27. <para>Starting at the bottom of a tree and coming across the numbers 2 and
  28. 3 which are joined by the multiplication symbol, the computer
  29. multiplies 2 and 3. The result of that multiplication is remembered and
  30. the next thing that the computer sees is the result of 2*3 and the
  31. number 1 which are joined by the add symbol. Adding 1 to the previous
  32. result makes 7. In calculating the most complex calculations can be
  33. broken down in this tree format and the computer just starts at the
  34. bottom and works its way up to the top and comes with the correct
  35. answer. Of course, Bison isn't only used for calculators
  36. alone.</para></sect4>
  37. <sect4><title>yacc</title>
  38. <para>We create a yacc script which calls bison using the -y option.
  39. This is for compatibility purposes for programs which use yacc instead
  40. of bison.</para></sect4>
  41. </sect3>
  42. </sect2>