29#include "../../include/grammar.h"
30#include "../../include/rule_macros.h"
33#define BC_PRODUCTION_COUNT 12
35#define BC_MAX_ALTERNATIVE_COUNT 3
37#define BC_MAX_ALTERNATIVE_SIZE 4
41 TK_MINUS, TK_PLUS, TK_MULT, TK_DIV,
42 TK_LPAREN, TK_RPAREN, TK_ENDSYM,
44 TK_DUMMY_AMBIGUITY_TRIGGER,
50 NT_EXPR, NT_EXPR_REST, NT_EXPR_OP,
51 NT_TERM, NT_TERM_REST, NT_TERM_OP,
52 NT_FACTOR, NT_OPTSIGN,
58const char bc_tks[] = {
68const char *
const bc_nt_names[] = {
69 "unsigned",
"optsign",
"sign",
71 "expr",
"expr_rest",
"expr_op",
72 "term",
"term_rest",
"term_op",
79bc[BC_PRODUCTION_COUNT]
80 [BC_MAX_ALTERNATIVE_COUNT + 1 ]
81 [BC_MAX_ALTERNATIVE_SIZE + 1 ] = {
89 rrr(EXPR, (
NT(TERM)), (
NT(EXPR_OP),
NT(TERM))),
96 rrr(TERM, (
NT(FACTOR)), (
NT(TERM_OP),
NT(FACTOR))),
103 NT(OPTSIGN),
NT(ATOM)
114 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...
#define rrr(head, base, suffix)
Defines right-recursive list rules. base and suffix parameters should wrapped with parenthesis (()).
#define NT(nt)
Macro to create a nonterminal production symbol.
#define TK(tk)
Macro to create a terminal (token) production symbol.
#define r(...)
Macro to define a grammar rule. Adds end of alternative and end of production body sentinels to gramm...
#define alt
Separates grammar alternatives (alternative separator).
A terminal or nonterminal representing the body (right side) of a production rule.