librdesc
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1
8#ifndef RDESC_UTIL_H
9#define RDESC_UTIL_H
10
11#include <stdio.h>
12
13
14struct rdesc_node; /* defined in rdesc.h */
15struct rdesc_token;
17
18struct rdesc_cfg; /* defined in cfg.h */
19
20
22typedef void (*rdesc_tk_printer_func)(const struct rdesc_token *, FILE *out);
23
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
42void rdesc_dump_dot(const struct rdesc_node *n,
43 rdesc_tk_printer_func tk_printer,
44 const char *const nt_names[],
45 FILE *out);
46
61void rdesc_dump_bnf(const struct rdesc_cfg *cfg,
62 const char *const tk_names[],
63 const char *const nt_names[],
64 FILE *out);
65
66#ifdef __cplusplus
67}
68#endif
69
70
71#endif
Context-free grammar definition.
Definition: cfg.h:18
A node in the CST.
Definition: rdesc.h:68
nonterminal (syntatic variable) object for context-free grammar
Definition: rdesc.h:51
terminal (token) object for context-free grammar
Definition: rdesc.h:43
void rdesc_dump_dot(const struct rdesc_node *n, rdesc_tk_printer_func tk_printer, const char *const nt_names[], FILE *out)
Dumps the Concrete Syntax Tree (CST) as a Graphviz DOT graph.
void rdesc_dump_bnf(const struct rdesc_cfg *cfg, const char *const tk_names[], const char *const nt_names[], FILE *out)
Dumps the Context-Free Grammar in BNF format.
Definition: dump_bnf.c:42
void(* rdesc_tk_printer_func)(const struct rdesc_token *, FILE *out)
Function pointer type for printing tokens.
Definition: util.h:22