diff options
| author | kartofen <kartofen.mail.0@protonmail.com> | 2025-09-13 15:24:28 +0300 |
|---|---|---|
| committer | kartofen <kartofen.mail.0@protonmail.com> | 2025-09-13 15:24:28 +0300 |
| commit | db1b9c8dcb0d115217a33c2fe8e0760d49143e11 (patch) | |
| tree | c93743adff3d78ea066c14879b7d2bfeb3ce42fb /demos/sample-files/gram-defs.c | |
| parent | 46e786db9d1b48b8fbc3502e36f093b755f3e09f (diff) | |
ast nearly build and proper errors
Diffstat (limited to 'demos/sample-files/gram-defs.c')
| -rw-r--r-- | demos/sample-files/gram-defs.c | 12 |
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);") \ |
