bison-desc.xml 1.7 KB

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