|
Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
|
Disambiguation Strategy Interface – pluggable conflict resolution. More...
Go to the source code of this file.
Data Structures | |
| struct | DisambiguationStrategyVTable |
| Function pointer table for a disambiguation strategy implementation. More... | |
| struct | StrategyResult |
| The result of a disambiguation resolution. More... | |
Typedefs | |
| typedef struct DisambiguationContext | DisambiguationContext |
| Opaque disambiguation context handle. | |
Enumerations | |
| enum | LimeStrategy { STRAT_PRIORITY = 0 , STRAT_FORK_RESOLVE = 1 , STRAT_BAYESIAN = 2 , STRAT_LLM = 3 , STRAT_CUSTOM = 4 } |
| Enumeration of available disambiguation strategies. More... | |
Functions | |
| DisambiguationContext * | disambiguation_create (LimeStrategy strategy, struct ExtensionRegistry *reg) |
| Create a disambiguation context using a built-in strategy. | |
| DisambiguationContext * | disambiguation_create_custom (const DisambiguationStrategyVTable *vtable, struct ExtensionRegistry *reg) |
| Create a disambiguation context using a user-supplied vtable. | |
| void | disambiguation_destroy (DisambiguationContext *ctx) |
| Destroy a disambiguation context and free all resources. | |
| LimeStrategy | disambiguation_get_strategy (const DisambiguationContext *ctx) |
| Get the strategy type used by this context. | |
| StrategyResult | disambiguation_resolve (DisambiguationContext *ctx, const ConflictPoint *conflict, struct ParseContext *parse_ctx) |
| Resolve a conflict using the configured strategy. | |
| const char * | disambiguation_strategy_name (LimeStrategy strategy) |
| Get the name of a strategy as a string. | |
| void | disambiguation_update (DisambiguationContext *ctx, bool success) |
| Provide feedback after a parse. | |
| void | strategy_result_cleanup (StrategyResult *result) |
| Free memory owned by a StrategyResult. | |
| void | strategy_result_init (StrategyResult *result) |
| Initialize a StrategyResult to a safe empty state. | |
Disambiguation Strategy Interface – pluggable conflict resolution.
Provides a pluggable strategy system for resolving conflicts between grammar extensions. When multiple extensions contribute modifications that conflict (e.g. shift/reduce, reduce/reduce, or duplicate rules), a disambiguation strategy decides which extension "wins" or how to reconcile them.
Strategies are selected at configuration time and dispatched through a vtable. Built-in strategies include:
| Strategy | Description |
|---|---|
| STRAT_PRIORITY | Resolve by static priority ordering |
| STRAT_FORK_RESOLVE | Fork parse state, try both, pick winner |
| STRAT_BAYESIAN | Accumulate evidence, pick most likely |
| STRAT_LLM | Query an LLM oracle for guidance |
| STRAT_CUSTOM | User-supplied vtable |
Types LimeContext and ConflictPoint are defined in conflict.h, which is the canonical owner of those types.
Definition in file disambiguation.h.