diff options
| author | kartofen <kartofen.mail.0@protonmail.com> | 2025-07-17 01:27:05 +0300 |
|---|---|---|
| committer | kartofen <kartofen.mail.0@protonmail.com> | 2025-07-17 01:27:05 +0300 |
| commit | 174e9b35ce3b6e99e500907f1bb24c6f31f481bf (patch) | |
| tree | 01448f5b8201ce92f684737b188599e3f227064b /lr-parser.c | |
| parent | 4544ab55bc432dd567318c727de60307e700243f (diff) | |
ok precedence
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); |
