36 |
|
|
37 |
The rules receive rule numbers 1 to NRULES in the order they are |
The rules receive rule numbers 1 to NRULES in the order they are |
38 |
written. More precisely Bison augments the grammar with the |
written. More precisely Bison augments the grammar with the |
39 |
initial rule, `$axiom: START-SYMBOL EOF', which is numbered 1, all |
initial rule, `$accept: START-SYMBOL $end', which is numbered 1, |
40 |
the user rules are 2, 3 etc. Each time a rule number is presented |
all the user rules are 2, 3 etc. Each time a rule number is |
41 |
to the user, we subtract 1, so *displayed* rule numbers are 0, 1, |
presented to the user, we subtract 1, so *displayed* rule numbers |
42 |
2... |
are 0, 1, 2... |
43 |
|
|
44 |
Internally, we cannot use the number 0 for a rule because for |
Internally, we cannot use the number 0 for a rule because for |
45 |
instance RITEM stores both symbol (the RHS) and rule numbers: the |
instance RITEM stores both symbol (the RHS) and rule numbers: the |
46 |
symbols are shorts >= 0, and rule number are stored negative. |
symbols are shorts >= 0, and rule number are stored negative. |
47 |
Therefore 0 cannot be used, since it would be both the rule number |
Therefore 0 cannot be used, since it would be both the rule number |
48 |
0, and the token EOF). |
0, and the token $end). |
49 |
|
|
50 |
Actions are accessed via the rule number. |
Actions are accessed via the rule number. |
51 |
|
|
68 |
|
|
69 |
RULES[R].assoc -- the associativity of R. |
RULES[R].assoc -- the associativity of R. |
70 |
|
|
71 |
RULES[R].dprec -- the dynamic precedence level of R (for GLR parsing). |
RULES[R].dprec -- the dynamic precedence level of R (for GLR |
72 |
|
parsing). |
73 |
|
|
74 |
RULES[R].merger -- index of merging function for R (for GLR parsing). |
RULES[R].merger -- index of merging function for R (for GLR |
75 |
|
parsing). |
76 |
|
|
77 |
RULES[R].line -- the line where R was defined. |
RULES[R].line -- the line where R was defined. |
78 |
|
|