|
librdesc
|
Grammar data structures. More...
#include "detail.h"#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | rdesc_grammar |
| Grammar definition. More... | |
| struct | rdesc_grammar_symbol |
| A terminal or nonterminal representing the body (right side) of a production rule. More... | |
Macros | |
| #define | rdesc_grammar_init_checked(grammar, production_count, max_alternative_count, max_alternative_size, production_rules) |
| Grammar initialization instrumented with size assertion. | |
Enumerations | |
| enum | rdesc_grammar_symbol_type { RDESC_TOKEN , RDESC_NONTERMINAL , RDESC_SENTINEL } |
Symbol type discriminator for rdesc_grammar_symbol. More... | |
Functions | |
| int | rdesc_grammar_init (struct rdesc_grammar *grammar, uint16_t production_count, uint16_t max_alternative_count, uint16_t max_alternative_size, const struct rdesc_grammar_symbol *production_rules) _rdesc_wur |
| Initializes a grammar struct. | |
| void | rdesc_grammar_destroy (struct rdesc_grammar *grammar) |
| Frees resources allocated by the grammar. | |
Grammar data structures.
This header defines the core data structures used to represent a grammar in librdesc.
| #define rdesc_grammar_init_checked | ( | grammar, | |
| production_count, | |||
| max_alternative_count, | |||
| max_alternative_size, | |||
| production_rules | |||
| ) |
Grammar initialization instrumented with size assertion.
This is the checked variant of rdesc_grammar_init. It ensures that the provided production_rules array matches the expected size.
Symbol type discriminator for rdesc_grammar_symbol.
| Enumerator | |
|---|---|
| RDESC_SENTINEL | Sentinel marking the end of a production body or the end of all alternatives for a nonterminal. |
| int rdesc_grammar_init | ( | struct rdesc_grammar * | grammar, |
| uint16_t | production_count, | ||
| uint16_t | max_alternative_count, | ||
| uint16_t | max_alternative_size, | ||
| const struct rdesc_grammar_symbol * | production_rules | ||
| ) |
Initializes a grammar struct.
production_count is equal to total number of nonterminals.