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