1 |
/* Data definitions for internal representation of bison's input, |
/* Data definitions for internal representation of bison's input, |
2 |
Copyright 1984, 1986, 1989, 1992 Free Software Foundation, Inc. |
Copyright 1984, 1986, 1989, 1992, 2001 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of Bison, the GNU Compiler Compiler. |
This file is part of Bison, the GNU Compiler Compiler. |
5 |
|
|
38 |
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 |
39 |
written. Actions and guards are accessed via the rule number. |
written. Actions and guards are accessed via the rule number. |
40 |
|
|
41 |
The rules themselves are described by three arrays: rrhs, rlhs and |
The rules themselves are described by several arrays: amongst which |
42 |
ritem. rlhs[R] is the symbol number of the left hand side of rule |
RITEM, and RULE_TABLE. |
43 |
R. The right hand side is stored as symbol numbers in a portion of |
|
44 |
ritem. rrhs[R] contains the index in ritem of the beginning of the |
RULE_TABLE is an array of struct rule_s, which members are: |
45 |
|
|
46 |
|
RULE_TABLE[R].lhs -- the symbol number of the left hand side of |
47 |
|
rule R. If -1, the rule has been thrown out by reduce.c and should |
48 |
|
be ignored. |
49 |
|
|
50 |
|
RULE_TABLE[R].rhs -- the index in RITEM of the beginning of the |
51 |
portion for rule R. |
portion for rule R. |
52 |
|
|
53 |
If rlhs[R] is -1, the rule has been thrown out by reduce.c and |
The right hand side is stored as symbol numbers in a portion of |
54 |
should be ignored. |
RITEM. |
55 |
|
|
56 |
The length of the portion is one greater than the number of symbols |
The length of the portion is one greater than the number of symbols |
57 |
in the rule's right hand side. The last element in the portion |
in the rule's right hand side. The last element in the portion |
58 |
contains minus R, which identifies it as the end of a portion and |
contains minus R, which identifies it as the end of a portion and |
59 |
says which rule it is for. |
says which rule it is for. |
60 |
|
|
61 |
The portions of ritem come in order of increasing rule number and |
The portions of RITEM come in order of increasing rule number and |
62 |
are followed by an element which is zero to mark the end. nitems |
are followed by an element which is zero to mark the end. nitems |
63 |
is the total length of ritem, not counting the final zero. Each |
is the total length of ritem, not counting the final zero. Each |
64 |
element of ritem is called an "item" and its index in ritem is an |
element of ritem is called an "item" and its index in ritem is an |
90 |
extern int nvars; |
extern int nvars; |
91 |
|
|
92 |
extern short *ritem; |
extern short *ritem; |
93 |
extern short *rlhs; |
|
|
extern short *rrhs; |
|
94 |
extern short *rprec; |
extern short *rprec; |
95 |
extern short *rprecsym; |
extern short *rprecsym; |
96 |
extern short *sprec; |
extern short *sprec; |
100 |
|
|
101 |
extern int start_symbol; |
extern int start_symbol; |
102 |
|
|
103 |
|
typedef struct rule_s |
104 |
|
{ |
105 |
|
short lhs; |
106 |
|
short rhs; |
107 |
|
} rule_t; |
108 |
|
|
109 |
|
extern struct rule_s *rule_table; |
110 |
|
|
111 |
/* associativity values in elements of rassoc, sassoc. */ |
/* associativity values in elements of rassoc, sassoc. */ |
112 |
typedef enum |
typedef enum |