diff options
author | kartofen <mladenovnasko0@gmail.com> | 2025-07-17 01:27:05 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2025-07-17 01:27:05 +0300 |
commit | 7ccd9286bafbd01fbda67c2f234998c2e591ed2a (patch) | |
tree | 01448f5b8201ce92f684737b188599e3f227064b /lr-parser.c | |
parent | 8ea8bd7e41c48be9635c29fb928fe9decc4eb112 (diff) |
Diffstat (limited to 'lr-parser.c')
-rw-r--r-- | lr-parser.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lr-parser.c b/lr-parser.c index 827b502..799276d 100644 --- a/lr-parser.c +++ b/lr-parser.c @@ -93,7 +93,7 @@ size_t total_symbols = 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), 0} +#define PROD(LHS, _, ...) {LHS, (symbol[]){__VA_ARGS__}, sizeof((symbol[]){__VA_ARGS__})/sizeof(symbol)} static struct production _grammar[] = { PROD(EP, ->, E, END_INPUT), PROD(E, -->, E, PLUS, T), @@ -105,6 +105,9 @@ static struct production _grammar[] = { PROD(N, -->, N1), }; +int *precedence_symbol = (int[]){0}; +int *precedence_production = (int[]){0}; + struct production *grammar = _grammar; size_t total_productions = sizeof(_grammar)/sizeof(*_grammar); |