|
librdesc
|
Development and Debugging Utilities. More...
#include <stdio.h>Go to the source code of this file.
Typedefs | |
| typedef void(* | rdesc_tk_printer_func) (const struct rdesc_token *, FILE *out) |
| Function pointer type for printing tokens. | |
Functions | |
| 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. | |
Development and Debugging Utilities.
This header provides tools for visualizing data structures in librdesc.
| 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.
Iterates over the production rules defined in the configuration and prints them in a human-readable BNF format. (e.g.A ::= B | C)
| cfg | Underlying CFG |
| tk_names | The token name or literal representation (e.g., IDENT or +). If you do not want to put double quotes around token name, put @ to beginning of the name. |
| nt_names | The raw name of the non-terminal (e.g., expr). The dumper handles the surrounding < and > characters automatically. |
| out | Output file stream |
| 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.
Traverses the CST and generates a .dot representation.
| n | CST node |
| nt_names | The raw name of the non-terminal (e.g., expr). The dumper handles the surrounding < and > characters automatically. |
| tk_printer | Callback to print token names.
|
| out | Output file stream |