|
librdesc
|
Boolean algebra grammar example for librdesc. More...
Go to the source code of this file.
Macros | |
| #define | BALG_PRODUCTION_COUNT 17 |
Total count of nonterminal symbols defined in enum balg_nt. Determines the size of the first dimension of the grammar table. | |
| #define | BALG_MAX_ALTERNATIVE_COUNT 5 |
| Maximum number of alternatives for a single production and +1 for end of production sentinel. Used to dimension the static array (2nd dimension). | |
| #define | BALG_MAX_ALTERNATIVE_SIZE 4 |
| Maximum number of symbols in an alternative (Right-Hand Side) and +1 for end-of-body sentinel. Used to dimension the static array (3rd dimension). | |
Enumerations | |
| enum | balg_tk { TK_TRUE , TK_FALSE , TK_IDENT , TK_PIPE , TK_AMP , TK_EXCL , TK_LPAREN , TK_RPAREN , TK_LCURLY , TK_RCURLY , TK_EQ , TK_COMMA , TK_SEMI } |
| Terminal symbols (tokens). More... | |
| enum | balg_nt { NT_BIT , NT_IDENT , NT_CALL , NT_CALL_OPTPARAMS , NT_EXPR , NT_EXPR_REST , NT_TERM , NT_TERM_REST , NT_FACTOR , NT_ATOM , NT_STMT , NT_STMTS , NT_ASGN , NT_IDENT_LS , NT_IDENT_LS_REST , NT_EXPR_LS , NT_EXPR_LS_REST } |
| Nonterminal symbols. More... | |
Variables | |
| const char *const | balg_tk_names [] |
| Names of tokens that are used in BNF. | |
| const char *const | balg_tk_names_escaped [] |
| Names of tokens that can be used in dotlang graph (special chars are escaped). | |
| const char *const | balg_nt_names [] |
| Nonterminal names (for debugging/printing CST). | |
| static const struct rdesc_grammar_symbol | balg [BALG_PRODUCTION_COUNT][BALG_MAX_ALTERNATIVE_COUNT+1][BALG_MAX_ALTERNATIVE_SIZE+1] |
| Sample grammar. | |
Boolean algebra grammar example for librdesc.
This file defines a sample grammar for a simple Boolean Algebra language. It serves two main purposes:
rule_macros.h) to define grammars.Language features:
Definition in file boolean_algebra.h.
| #define BALG_MAX_ALTERNATIVE_COUNT 5 |
Maximum number of alternatives for a single production and +1 for end of production sentinel. Used to dimension the static array (2nd dimension).
Definition at line 38 of file boolean_algebra.h.
| #define BALG_MAX_ALTERNATIVE_SIZE 4 |
Maximum number of symbols in an alternative (Right-Hand Side) and +1 for end-of-body sentinel. Used to dimension the static array (3rd dimension).
Definition at line 45 of file boolean_algebra.h.
| #define BALG_PRODUCTION_COUNT 17 |
Total count of nonterminal symbols defined in enum balg_nt. Determines the size of the first dimension of the grammar table.
Definition at line 31 of file boolean_algebra.h.
| enum balg_nt |
Nonterminal symbols.
Definition at line 63 of file boolean_algebra.h.
| enum balg_tk |
Terminal symbols (tokens).
rdesc. Tokens cannot start from 0. Definition at line 52 of file boolean_algebra.h.
|
static |
Sample grammar.
rrr(X, ...) macro expands into two consecutive production rules, NT_X and NT_X_REST.TK(X)/NT(X) expand to TK_X/NT_X. You must use TK(X)/NT(X) instead of TK(TK_X)/NT(NT_X). See Name Mapping for Identifiers for overriding default behavior and details.Definition at line 129 of file boolean_algebra.h.
| const char* const balg_nt_names[] |
Nonterminal names (for debugging/printing CST).
Definition at line 100 of file boolean_algebra.h.
| const char* const balg_tk_names[] |
Names of tokens that are used in BNF.
Definition at line 81 of file boolean_algebra.h.
| const char* const balg_tk_names_escaped[] |
Names of tokens that can be used in dotlang graph (special chars are escaped).
Definition at line 92 of file boolean_algebra.h.