- BSet Vp, Vs, Pp;
- int i, n;
- short t;
- rule r;
-
- /*
- * Find out which productions are reachable and which symbols are
- * used. Starting with an empty set of productions and a set of
- * symbols which only has the start symbol in it, iterate over all
- * productions until the set of productions remains unchanged for an
- * iteration. For each production which has a LHS in the set of
- * reachable symbols, add the production to the set of reachable
- * productions, and add all of the nonterminals in the RHS of the
- * production to the set of reachable symbols.
- *
- * Consider only the (partially) reduced grammar which has only
- * nonterminals in N and productions in P.
- *
- * The result is the set P of productions in the reduced grammar, and
- * the set V of symbols in the reduced grammar.
- *
- * Although this algorithm also computes the set of terminals which are
- * reachable, no terminal will be deleted from the grammar. Some
- * terminals might not be in the grammar but might be generated by
- * semantic routines, and so the user might want them available with
- * specified numbers. (Is this true?) However, the nonreachable
- * terminals are printed (if running in verbose mode) so that the user
- * can know.
- */
-
- Vp = NEW2(WORDSIZE(nsyms), unsigned);
- Pp = NEW2(WORDSIZE(nrules + 1), unsigned);
+ bitset Vp, Vs, Pp;
+
+ /* Find out which productions are reachable and which symbols are
+ used. Starting with an empty set of productions and a set of
+ symbols which only has the start symbol in it, iterate over all
+ productions until the set of productions remains unchanged for an
+ iteration. For each production which has a LHS in the set of
+ reachable symbols, add the production to the set of reachable
+ productions, and add all of the nonterminals in the RHS of the
+ production to the set of reachable symbols.
+
+ Consider only the (partially) reduced grammar which has only
+ nonterminals in N and productions in P.
+
+ The result is the set P of productions in the reduced grammar,
+ and the set V of symbols in the reduced grammar.
+
+ Although this algorithm also computes the set of terminals which
+ are reachable, no terminal will be deleted from the grammar. Some
+ terminals might not be in the grammar but might be generated by
+ semantic routines, and so the user might want them available with
+ specified numbers. (Is this true?) However, the nonreachable
+ terminals are printed (if running in verbose mode) so that the
+ user can know. */
+
+ Vp = bitset_create (nsyms, BITSET_FIXED);
+ Pp = bitset_create (nrules, BITSET_FIXED);