23#include "../../include/grammar.h"
24#include "../../include/rule_macros.h"
31#define BALG_PRODUCTION_COUNT 17
38#define BALG_MAX_ALTERNATIVE_COUNT 5
45#define BALG_MAX_ALTERNATIVE_SIZE 4
54 TK_TRUE, TK_FALSE, TK_IDENT,
56 TK_PIPE, TK_AMP, TK_EXCL,
58 TK_LPAREN, TK_RPAREN, TK_LCURLY, TK_RCURLY,
59 TK_EQ, TK_COMMA, TK_SEMI,
64 NT_BIT, NT_IDENT, NT_CALL,
68 NT_EXPR, NT_EXPR_REST,
69 NT_TERM, NT_TERM_REST,
73 NT_STMT, NT_STMTS, NT_ASGN,
76 NT_IDENT_LS, NT_IDENT_LS_REST,
77 NT_EXPR_LS, NT_EXPR_LS_REST,
95 "(",
")",
"\\{",
"\\}",
101 "bit",
"ident",
"call",
108 "stmt",
"stmts",
"asgn",
110 "ident_ls",
"ident_ls_rest",
111 "expr_ls",
"expr_ls_rest",
140 TK(IDENT),
TK(LPAREN),
NT(CALL_OPTPARAMS),
TK(RPAREN)
146 rrr(EXPR, (
NT(TERM)), (
TK(PIPE),
NT(TERM))),
149 rrr(TERM, (
NT(FACTOR)), (
TK(AMP),
NT(FACTOR))),
164 TK(LPAREN),
NT(EXPR),
TK(RPAREN)
181 NT(IDENT_LS),
TK(EQ),
NT(EXPR_LS)
185 rrr(IDENT_LS, (
NT(IDENT)), (
TK(COMMA),
NT(IDENT))),
188 rrr(EXPR_LS, (
NT(EXPR)), (
TK(COMMA),
NT(EXPR)))
const char *const balg_tk_names[]
Names of tokens that are used in BNF.
Definition boolean_algebra.h:81
static const struct rdesc_grammar_symbol balg[BALG_PRODUCTION_COUNT][BALG_MAX_ALTERNATIVE_COUNT+1][BALG_MAX_ALTERNATIVE_SIZE+1]
Sample grammar.
Definition boolean_algebra.h:131
const char *const balg_nt_names[]
Nonterminal names (for debugging/printing CST).
Definition boolean_algebra.h:100
const char *const balg_tk_names_escaped[]
Names of tokens that can be used in dotlang graph (special chars are escaped).
Definition boolean_algebra.h:92
balg_nt
Nonterminal symbols.
Definition boolean_algebra.h:63
balg_tk
Terminal symbols (tokens).
Definition boolean_algebra.h:52
#define BALG_MAX_ALTERNATIVE_COUNT
Maximum number of alternatives for a single production and +1 for end of production sentinel....
Definition boolean_algebra.h:38
#define BALG_MAX_ALTERNATIVE_SIZE
Maximum number of symbols in an alternative (Right-Hand Side) and +1 for end-of-body sentinel....
Definition boolean_algebra.h:45
#define BALG_PRODUCTION_COUNT
Total count of nonterminal symbols defined in enum balg_nt. Determines the size of the first dimensio...
Definition boolean_algebra.h:31
#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 ropt(...)
Macro to define an optional grammar rule (epsilon production).
Definition rule_macros.h:91
#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