From 5064a7ebce75a26d0405c92040f1a40187fcc7e3 Mon Sep 17 00:00:00 2001 From: kartofen Date: Wed, 2 Jul 2025 22:55:08 +0300 Subject: turn clr into lalr and first steps for generating a parser --- slr-table.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'slr-table.c') diff --git a/slr-table.c b/slr-table.c index 76399d7..d5f4505 100644 --- a/slr-table.c +++ b/slr-table.c @@ -17,7 +17,8 @@ extern void *xcalloc(size_t n, size_t size); #include "parts/table.h" #define TABLE_CAP 64 -struct action *table[TABLE_CAP]; +static struct action *__table[TABLE_CAP]; +struct action **table = __table; size_t table_states = 0; int table_fill(); @@ -224,7 +225,7 @@ enum symbol { SYMBOLS_END, }; -const size_t total_symbols = SYMBOLS_END; +size_t total_symbols = SYMBOLS_END; int symbol_is_terminal(symbol s) { return s < EP; } int symbol_is_input_end(symbol s) { return s == END_INPUT; } @@ -251,9 +252,9 @@ int main(void) { util_tables_fill(); table_fill(); - + table_print(); - + table_free(); util_tables_free(); } -- cgit v1.2.3