From b4261ac4a79651bd8fd1bd03d38bbf49ee89b615 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 6 Jul 2025 21:18:28 +0300 Subject: modular table building --- lr-parser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lr-parser.c') diff --git a/lr-parser.c b/lr-parser.c index f7197c5..0d244fd 100644 --- a/lr-parser.c +++ b/lr-parser.c @@ -1,8 +1,9 @@ #include #include -// TODO: check erros and fail safely and -// see connection with the lexer +// TODO: - check erros and fail safely and +// see connection with the lexer +// - standardize this // Requirements #include "parts/symbol.h" @@ -86,7 +87,7 @@ enum symbol { size_t total_symbols = SYMBOLS_END; -IMPLEMENT_FUNCPTR(int, symbol_is_valid, (symbol s), { return s < SYMBOLS_END; }) +IMPLEMENT_FUNCPTR(int, symbol_is_valid, (symbol s)) { return s < SYMBOLS_END; } // implement grammar.h #define PROD(LHS, _, ...) {LHS, (symbol[]){__VA_ARGS__}, sizeof((symbol[]){__VA_ARGS__})/sizeof(symbol)} @@ -130,7 +131,7 @@ static symbol *tok = toklist; symbol toklist_eat() { return *(tok++); } // unsafe symbol toklist_peek() { return *tok; } // unsafe -int none(int *stack_head) {(void)stack_head; return 0;}; +int none(int *stack_head) {(void)stack_head; return 0;} semantic_action_fn *semantic_actions = (semantic_action_fn[]){none, none, none, none, none, none, none, none}; int main(void) -- cgit v1.2.3