diff options
Diffstat (limited to 'util-tables.c')
-rw-r--r-- | util-tables.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/util-tables.c b/util-tables.c index 09df914..507153d 100644 --- a/util-tables.c +++ b/util-tables.c @@ -121,13 +121,9 @@ enum symbol { size_t total_symbols = SYMBOLS_END; -int symbol_is_terminal(symbol s) { return s < E; } -int symbol_is_nonterminal(symbol s) { return s >= E; } -int symbol_is_input_end(symbol s) { return s == END_INPUT; } - // implement grammar.h #define PROD(LHS, _, ...) {LHS, (symbol[]){__VA_ARGS__}, sizeof((symbol[]){__VA_ARGS__})/sizeof(symbol)} -struct production grammar[] = { +static struct production _grammar[] = { PROD(EP, ->, E, END_INPUT), PROD(E, -->, E, PLUS, T), PROD(E, -->, E, MINUS, T), @@ -137,8 +133,8 @@ struct production grammar[] = { PROD(N, -->, N0), PROD(N, -->, N1), }; - -const size_t total_productions = sizeof(grammar)/sizeof(*grammar); +struct production *grammar = _grammar; +size_t total_productions = sizeof(_grammar)/sizeof(*_grammar); int main(void) { |