aboutsummaryrefslogtreecommitdiff
path: root/demos/sample-files/gram-defs.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/sample-files/gram-defs.c')
-rw-r--r--demos/sample-files/gram-defs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/demos/sample-files/gram-defs.c b/demos/sample-files/gram-defs.c
index b1ae268..97312c7 100644
--- a/demos/sample-files/gram-defs.c
+++ b/demos/sample-files/gram-defs.c
@@ -1,10 +1,10 @@
#include "util/util.h"
#define SYMBOLS(X) \
X(TERMINAL) X(NONTERM) X(LEFT) X(RIGHT) X(NOPREC) \
- X(COLON) X(PIPE) X(SEMICOL) X(DOT) \
+ X(STYPE) X(COLON) X(PIPE) X(SEMICOL) X(DOT) \
X(IDEN) X(NUM) X(ACTION) X(END_INPUT) \
\
- X(S) X(A) X(B) X(C) \
+ X(SP) X(S) X(A) X(T) X(B) X(C) \
X(Type) X(Prec) X(Prod) X(Preclist) X(Prodlist) \
X(Actionlist) X(Idenlist) X(IorNlist) \
X(SYMBOLS_END) \
@@ -22,11 +22,15 @@ IMPLEMENT_FUNCPTR(int, symbol_is_valid, (symbol s)) { return s < SYMBOLS_END; }
#include "parts/grammar.h"
#define PROD(LHS, _, ...) {LHS, (symbol[]){__VA_ARGS__}, sizeof((symbol[]){__VA_ARGS__})/sizeof(symbol)}
#define GRAMMAR_ACTION_DEF(X) \
- X(PROD(S, -->, A, B, C, END_INPUT), "") \
+ X(PROD(SP, -->, S, END_INPUT), "") \
+ X(PROD(S, -->, A, B, C), "") \
+ X(PROD(S, -->, A, T, B, C), "") \
\
X(PROD(A, -->, TERMINAL, Idenlist, \
SEMICOL, NONTERM, Idenlist, DOT), \
- "handle_type(A(1), A(4))") \
+ "handle_enum(A(1), A(4));") \
+ X(PROD(T, -->, STYPE, ACTION, DOT), \
+ "handle_stype(A(1));") \
\
X(PROD(B, -->, Preclist), "handle_prec(A(0));") \
X(PROD(B, -->, NOPREC, DOT), "handle_prec(NULL);") \