+ return i >= 0;
+}
+
+/* Rule numbers. */
+typedef int rule_number;
+#define RULE_NUMBER_MAX INT_MAX
+extern rule_number nrules;
+
+static inline item_number
+rule_number_as_item_number (rule_number r)
+{
+ return -1 - r;
+}
+
+static inline rule_number
+item_number_as_rule_number (item_number i)
+{
+ return -1 - i;
+}
+
+static inline bool
+item_number_is_rule_number (item_number i)
+{
+ return i < 0;
+}
+
+/*--------.
+| Rules. |
+`--------*/
+
+typedef struct
+{
+ /* The number of the rule in the source. It is usually the index in
+ RULES too, except if there are useless rules. */
+ rule_number user_number;
+
+ /* The index in RULES. Usually the rule number in the source,
+ except if some rules are useless. */
+ rule_number number;
+
+ symbol *lhs;
+ item_number *rhs;
+
+ /* This symbol provides both the associativity, and the precedence. */
+ symbol *prec;
+
+ int dprec;
+ int merger;
+
+ /* This symbol was attached to the rule via %prec. */
+ symbol *precsym;
+
+ location location;