aboutsummaryrefslogtreecommitdiff
path: root/parts
diff options
context:
space:
mode:
Diffstat (limited to 'parts')
-rw-r--r--parts/grammar.h1
-rw-r--r--parts/table.h6
-rw-r--r--parts/toklist.h5
3 files changed, 7 insertions, 5 deletions
diff --git a/parts/grammar.h b/parts/grammar.h
index d1bf176..e747855 100644
--- a/parts/grammar.h
+++ b/parts/grammar.h
@@ -1,6 +1,7 @@
#ifndef GRAMMAR_H
#define GRAMMAR_H
+#include "symbol.h"
#include <stddef.h> // size_t
extern struct production {
diff --git a/parts/table.h b/parts/table.h
index efd19bb..c60ad4f 100644
--- a/parts/table.h
+++ b/parts/table.h
@@ -2,7 +2,7 @@
#define TABLE_H
#include <stddef.h> // size_t
-#include "util/util.h"
+#include "util/util.h" // X_TO_...
#define ACTION_TYPE(X) \
X(ACTION_NOT_SET) \
@@ -28,7 +28,7 @@ extern void (*table_free)();
void table_print();
void table_print_cstyle();
-int table_insert(size_t state, symbol sym, struct action a); // should it be here??
+int table_insert(size_t state, symbol sym, struct action a); // should this be here??
#include "symbol.h"
@@ -103,7 +103,7 @@ int table_insert(size_t state, symbol sym, struct action a)
if(prec_num(tbl_a) > prec_num(new_a)) set_tbl_a = 0;
else if(prec_num(tbl_a) < prec_num(new_a)) set_tbl_a = 1;
else { report = 1;
- if(new_a->arg > tbl_a->arg) set_tbl_a = 1;
+ if(new_a->arg < tbl_a->arg) set_tbl_a = 1;
}
} else if(shift_reduce) {
int favor_shift = 0;
diff --git a/parts/toklist.h b/parts/toklist.h
index 760846f..08fce66 100644
--- a/parts/toklist.h
+++ b/parts/toklist.h
@@ -1,12 +1,13 @@
#ifndef TOKLIST_H
#define TOKLIST_H
+#include <stdint.h> // intptr_t
#include "symbol.h"
struct token;
-symbol token_sym(struct token *t); // UB for NULL
-int token_val(struct token *t); // UB for NULL
+symbol token_sym(struct token *t); // t != NULL
+intptr_t token_val(struct token *t); // t != NULL
struct token *toklist_eat(); // always non-NULL
struct token *toklist_peek(); // always non-NULL