#ifndef grr_bypass_H #define grr_bypass_H /* grr_bypass.h - procedures for bypassing superfluous internal symbols */ /* Last edited on 2024-12-21 11:50:04 by stolfi */ #include #include #include #include #include #include Grammar_t *grr_remove_superfluous_symbols(Grammar_t *G); /* Returns a new grammar obtained from {G} by replacing some internal symbols by their definitions. E.g., if the input grammar is {X -> $A, Y -> Z $B, $A -> W} returns {X -> W, Y -> Z W}. Internal symbols are identified by the first letter of their name being '$' or '*'. Note that "F:*X" is not considered internal. A symbol /may/ be replaced if that would reduce the size of the grammar. In particular, an internal symbol that has at most one defining rule or at most one use in the RHS will be replaced. The result is not guaranteed to be minimal, and depends on the order in which symbols and rules are examined. A symbol cannot be replaced if it occurs on both sides of the '->' in the same rule, or if it has a binary definition and is used in another binary rule. */ #endif