|
Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
|
Function pointer table for a disambiguation strategy implementation. More...
#include <disambiguation.h>
Data Fields | |
| void(* | destroy )(void *strategy_context) |
| Tear down the strategy and free all resources. | |
| void *(* | init )(const struct Extension *const *extensions, uint32_t nextensions) |
| Initialize the strategy. | |
| bool(* | resolve )(void *strategy_context, const ConflictPoint *conflict, struct ParseContext *parse_ctx, int lookahead, StrategyResult *result) |
| Resolve a single conflict. | |
| void(* | update )(void *strategy_context, struct ExtensionRegistry *registry, bool success) |
| Provide feedback after a parse completes. | |
Function pointer table for a disambiguation strategy implementation.
Each strategy provides four callbacks. The opaque strategy_context pointer is strategy-specific state created by init() and freed by destroy().
Definition at line 136 of file disambiguation.h.
| void(* DisambiguationStrategyVTable::destroy) (void *strategy_context) |
Tear down the strategy and free all resources.
| strategy_context | Opaque pointer returned by init(). |
Definition at line 188 of file disambiguation.h.
| void *(* DisambiguationStrategyVTable::init) (const struct Extension *const *extensions, uint32_t nextensions) |
Initialize the strategy.
Called once when the DisambiguationContext is created. Receives the loaded extensions so the strategy can precompute any needed metadata (e.g. priority ordering).
| extensions | Array of loaded Extension pointers. |
| nextensions | Count of extensions. |
Definition at line 148 of file disambiguation.h.
| bool(* DisambiguationStrategyVTable::resolve) (void *strategy_context, const ConflictPoint *conflict, struct ParseContext *parse_ctx, int lookahead, StrategyResult *result) |
Resolve a single conflict.
| strategy_context | Opaque pointer returned by init(). | |
| conflict | The conflict point to resolve. | |
| parse_ctx | Current parse context (may be NULL if resolution happens before parsing starts). | |
| lookahead | Lookahead token code (-1 if not applicable). | |
| [out] | result | Filled with the resolution decision. |
| true | Conflict was resolved. |
| false | Resolution failed. |
Definition at line 163 of file disambiguation.h.
| void(* DisambiguationStrategyVTable::update) (void *strategy_context, struct ExtensionRegistry *registry, bool success) |
Provide feedback after a parse completes.
Strategies that learn (e.g. Bayesian) use this to update their models.
| strategy_context | Opaque pointer returned by init(). |
| registry | Extension registry for metadata lookups. |
| success | True if the parse succeeded. |
Definition at line 179 of file disambiguation.h.