26#include "../../include/grammar.h"
27#include "../../include/rule_macros.h"
30#define BC_PRODUCTION_COUNT 12
32#define BC_MAX_ALTERNATIVE_COUNT 3
34#define BC_MAX_ALTERNATIVE_SIZE 4
38 TK_MINUS, TK_PLUS, TK_MULT, TK_DIV,
39 TK_LPAREN, TK_RPAREN, TK_ENDSYM,
41 TK_DUMMY_AMBIGUITY_TRIGGER,
47 NT_EXPR, NT_EXPR_REST, NT_EXPR_OP,
48 NT_TERM, NT_TERM_REST, NT_TERM_OP,
49 NT_FACTOR, NT_OPTSIGN,
55const char bc_tks[] = {
65const char *
const bc_nt_names[] = {
66 "unsigned",
"optsign",
"sign",
68 "expr",
"expr_rest",
"expr_op",
69 "term",
"term_rest",
"term_op",
76bc[BC_PRODUCTION_COUNT]
77 [BC_MAX_ALTERNATIVE_COUNT + 1 ]
78 [BC_MAX_ALTERNATIVE_SIZE + 1 ] = {
86 rrr(EXPR, (
NT(TERM)), (
NT(EXPR_OP),
NT(TERM))),
93 rrr(TERM, (
NT(FACTOR)), (
NT(TERM_OP),
NT(FACTOR))),
100 NT(OPTSIGN),
NT(ATOM)
111 alt TK(LPAREN),
NT(EXPR),
TK(RPAREN),
TK(DUMMY_AMBIGUITY_TRIGGER)
#define EPSILON
Epsilon production (empty/null production). Use to represent an empty alternative that matches nothin...
Definition rule_macros.h:65
#define rrr(head, base, suffix)
Defines right-recursive list rules. base and suffix parameters should wrapped with parenthesis (()).
Definition rule_macros.h:121
#define NT(nt)
Macro to create a nonterminal production symbol.
Definition rule_macros.h:58
#define TK(tk)
Macro to create a terminal (token) production symbol.
Definition rule_macros.h:56
#define r(...)
Macro to define a grammar rule. Adds end of alternative and end of production body sentinels to gramm...
Definition rule_macros.h:72
#define alt
Separates grammar alternatives (alternative separator).
Definition rule_macros.h:133
A terminal or nonterminal representing the body (right side) of a production rule.
Definition grammar.h:87