aboutsummaryrefslogtreecommitdiff
path: root/slr-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'slr-table.c')
-rw-r--r--slr-table.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/slr-table.c b/slr-table.c
index ac90755..d9f289c 100644
--- a/slr-table.c
+++ b/slr-table.c
@@ -14,6 +14,7 @@ extern void *xcalloc(size_t n, size_t size);
// Requirements
#include "parts/symbol.h"
#include "parts/grammar.h"
+#include "parts/precedence.h"
#include "parts/util-tables.h"
// Implements
@@ -221,7 +222,7 @@ IMPLEMENT_FUNCPTR(int, symbol_is_terminal, (symbol s)) { return s < EP; }
IMPLEMENT_FUNCPTR(int, symbol_is_input_end, (symbol s)) { return s == END_INPUT; }
// 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),
@@ -236,6 +237,10 @@ static struct production _grammar[] = {
struct production *grammar = _grammar;
size_t total_productions = sizeof(_grammar)/sizeof(*_grammar);
+// implement precedence.h
+int *precedence_symbol = (int[]){0};
+int *precedence_production = (int[]){0};
+
// implement util-tables.h
#include "util-tables.c"