aboutsummaryrefslogtreecommitdiff
path: root/slr-table.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2025-07-02 22:55:08 +0300
committerkartofen <mladenovnasko0@gmail.com>2025-07-02 22:55:08 +0300
commit5064a7ebce75a26d0405c92040f1a40187fcc7e3 (patch)
tree7a41182cf329e77ebb760969e3f220f60079c187 /slr-table.c
parenta67266ff72280b85fed7ec498967a855a5735639 (diff)
turn clr into lalr and first steps for generating a parser
Diffstat (limited to 'slr-table.c')
-rw-r--r--slr-table.c9
1 files changed, 5 insertions, 4 deletions
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();
}