RULE_TABLE[R].rhs -- the index in RITEM of the beginning of the
portion for rule R.
+ RULE_TABLE[R].prec -- the precedence level of R.
+
+ RULE_TABLE[R].precsym -- the symbol-number of the symbol in %prec
+ for R (if any).
+
+ RULE_TABLE[R].assoc -- the associativity of R.
+
+ RULE_TABLE[R].line -- the line where R was defined.
+
+ RULE_TABLE[R].useful -- TRUE iff the rule is used.
+
The right hand side is stored as symbol numbers in a portion of
RITEM.
Item numbers are used in the finite state machine to represent
places that parsing can get to.
- Precedence levels are recorded in the vectors sprec and rprec.
- sprec records the precedence level of each symbol, rprec the
- precedence level of each rule. rprecsym is the symbol-number of
- the symbol in %prec for this rule (if any).
+ SPREC records the precedence level of each symbol.
Precedence levels are assigned in increasing order starting with 1
so that numerically higher precedence values mean tighter binding
extern int nvars;
extern short *ritem;
+extern int nritems;
-extern short *rprec;
-extern short *rprecsym;
extern short *sprec;
-extern short *rassoc;
extern short *sassoc;
-extern short *rline; /* Source line number of each rule */
extern int start_symbol;
-typedef struct rule_s
-{
- short lhs;
- short rhs;
-} rule_t;
-
-extern struct rule_s *rule_table;
-
/* associativity values in elements of rassoc, sassoc. */
typedef enum
{
} associativity;
+typedef struct rule_s
+{
+ short lhs;
+ short rhs;
+ short prec;
+ short precsym;
+ short assoc;
+ short line;
+ bool useful;
+
+ const char *action;
+ short action_line;
+
+ const char *guard;
+ short guard_line;
+} rule_t;
+
+extern struct rule_s *rule_table;
+
/* token translation table: indexed by a token number as returned by
the user's yylex routine, it yields the internal token number used
by the parser and throughout bison. */
/* ERROR_TOKEN_NUMBER is the token number of the error token. */
extern int error_token_number;
+
+
+/* Dump RITEM for traces. */
+void ritem_print PARAMS ((FILE *out));
+
+/* Return the size of the longest rule RHS. */
+size_t ritem_longest_rhs PARAMS ((void));
+
#endif /* !GRAM_H_ */