APG
… an ABNF Parser Generator
|
All of the code for generating Partially-Predictive Parsing Tables (PPPT). More...
Go to the source code of this file.
Macros | |
#define | TRACE_RULE_OPEN(n) |
#define | TRACE_RULE_LEAF(n, m) |
#define | TRACE_RULE_CLOSE(n) |
#define | TRACE_OPCODE_OPEN(o) |
#define | TRACE_OPCODE_CLOSE(o) |
Functions | |
void | vApiPppt (void *vpCtx, char **cppProtectedRules, aint uiProtectedRules) |
Compute the Partially-Predictive Parsing Tables. More... | |
void | vApiPpptSize (void *vpCtx, pppt_size *spSize) |
Compute the size of the PPPT maps and the number of bytes for the entire table. More... | |
All of the code for generating Partially-Predictive Parsing Tables (PPPT).
PPPTs can greatly reduce the number of node hits in the traversal of the parse tree and thus greatly reduce the computation times. However, not all grammars lend themselves to this approach. In particular, grammars with a large number of alphabet characters in the grammar will produce extremely large PPPTs. In some cases, impractically large or even impossibly large.
For example, if parsing a grammar that uses the full range of UTF-32 characters the alphabet character range is 0x00 - 0x10FFFF. Not a good fit for PPPTs.
Definition in file pppt.c.
void vApiPppt | ( | void * | vpCtx, |
char ** | cppProtectedRules, | ||
aint | uiProtectedRules | ||
) |
Compute the Partially-Predictive Parsing Tables.
vpCtx | Context pointer previously returned from vpApiCtor(). |
cppProtectedRules | An array of string pointers pointing to the rule names to protect. Protection means that the rule is generated, even if the PPPT would have been deterministic prior to calling the rule. May be NULL, in which case no rules are protected. |
uiProtectedRules | The number of protected rules. May be 0, in which case no rules are protected. |
void vApiPpptSize | ( | void * | vpCtx, |
pppt_size * | spSize | ||
) |
Compute the size of the PPPT maps and the number of bytes for the entire table.
This function may be called after vApiOpcodes() and before vApiPppt() to determine if the application has sufficient memory to handle the PPPTs. vApiOpcodes() is where the PPPT sizes are computed. The tables are not allocated until vApiPppt().
vpCtx | Context pointer previously returned from vpApiCtor(). |
spSize | Pointer to a pppt_size structure to receive the size information. |