bison-desc.xml 2.0 KB

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