bison-desc.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <sect2>
  2. <title>Contents</title>
  3. <para>
  4. The Bison package contains the bison program.
  5. </para>
  6. </sect2>
  7. <sect2><title>Description</title>
  8. <para>
  9. Bison is a parser generator, a replacement for YACC. YACC stands for Yet
  10. Another Compiler Compiler. What is Bison then? It is a program that
  11. generates a program that analyses the structure of a textfile. Instead
  12. of
  13. writing the actual program you specify how things should be connected
  14. and with
  15. those rules a program is constructed that analyses the textfile.
  16. </para>
  17. <para>
  18. There are alot of examples where structure is needed and one of them is
  19. the
  20. calculator.
  21. </para>
  22. <para>
  23. Given the string :
  24. </para>
  25. <blockquote><literallayout>
  26. 1 + 2 * 3
  27. </literallayout></blockquote>
  28. <para>
  29. You can easily come to the result 7. Why ? Because of the structure. You
  30. know
  31. how to interpretet the string. The computer doesn't know that and Bison
  32. is a
  33. tool to help it understand by presenting the string in the following way
  34. to the compiler:
  35. </para>
  36. <blockquote><literallayout>
  37. +
  38. / \
  39. * 1
  40. / \
  41. 2 3
  42. </literallayout></blockquote>
  43. <para>
  44. You start at the bottom of a tree and you come across the numbers 2 and
  45. 3 which are joined by the multiplication symbol, so the computers
  46. multiplies 2 and 3. The result of that multiplication is remembered and
  47. the next thing that the computer sees is the result of 2*3 and the
  48. number 1 which are joined by the add symbol. Adding 1 to the previous
  49. result makes 7. In calculating the most complex calculations can be
  50. broken down in this tree format and the computer just starts at the
  51. bottom and works it's way up to the top and comes with the correct
  52. answer. Of course, Bison isn't only used for calculators alone.
  53. </para>
  54. </sect2>