|
librdesc
|
Boolean algebra grammar example for librdesc. More...
Go to the source code of this file.
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. | |
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:
| enum balg_tk |
Terminal symbols (tokens).
rdesc. Tokens cannot start from 0.
|
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.| const char* const balg_nt_names[] |
Nonterminal names (for debugging/printing CST).
| 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).