librdesc
Loading...
Searching...
No Matches
cfg.h
Go to the documentation of this file.
1
9#ifndef RDESC_CFG_H
10#define RDESC_CFG_H
11
12#include <stdint.h>
13
14
18struct rdesc_cfg {
20 const struct rdesc_cfg_symbol *rules;
22 uint32_t nt_count;
29 uint16_t *child_caps;
30};
31
34 CFG_TOKEN,
35 CFG_NONTERMINAL,
39};
40
47 int id ;
48};
49
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
56void rdesc_cfg_init(struct rdesc_cfg *cfg,
57 uint32_t nonterminal_count,
58 uint16_t nonterminal_variant_count,
59 uint16_t nonterminal_body_length,
60 const struct rdesc_cfg_symbol *production_rules);
61
63void rdesc_cfg_destroy(struct rdesc_cfg *cfg);
64
65#ifdef __cplusplus
66}
67#endif
68
69
70#endif
void rdesc_cfg_destroy(struct rdesc_cfg *cfg)
Frees the context-free grammar struct.
Definition: cfg.c:44
void rdesc_cfg_init(struct rdesc_cfg *cfg, uint32_t nonterminal_count, uint16_t nonterminal_variant_count, uint16_t nonterminal_body_length, const struct rdesc_cfg_symbol *production_rules)
Initializes a context-free grammar object.
Definition: cfg.c:9
rdesc_cfg_symbol_type
The type of rdesc_cfg_symbol (the union's tag)
Definition: cfg.h:33
@ CFG_SENTINEL
sentinel for terminating production body or variants of a non-terminal
Definition: cfg.h:38
A terminal/non-terminal to describe body (right side) of a production rule.
Definition: cfg.h:45
enum rdesc_cfg_symbol_type ty
Definition: cfg.h:46
Context-free grammar definition.
Definition: cfg.h:18
uint16_t * child_caps
Definition: cfg.h:29
uint16_t nt_variant_count
Definition: cfg.h:25
uint16_t nt_body_length
Definition: cfg.h:27
const struct rdesc_cfg_symbol * rules
Definition: cfg.h:20
uint32_t nt_count
Definition: cfg.h:22