Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
Multi-Grammar Conflict Detection API

Scan loaded extensions for token, rule, and semantic conflicts. More...

Functions

bool detect_all_multi_grammar_conflicts (struct ExtensionRegistry *reg, MultiGrammarConflictResult *result)
 Run a full multi-grammar conflict scan across all loaded extensions.
 
ConflictPoint detect_conflict (struct ExtensionRegistry *reg, uint16_t token, int state)
 Detect all levels of conflict for a specific token and state.
 
uint32_t detect_rule_conflicts (struct ExtensionRegistry *reg, uint16_t token, int state, MultiGrammarConflictResult *result)
 Detect rule-level conflicts for a given token and state.
 
uint32_t detect_semantic_conflicts (struct ExtensionRegistry *reg, uint16_t token, int state, MultiGrammarConflictResult *result)
 Detect semantic-level conflicts for a given token and state.
 
uint32_t detect_token_conflicts (struct ExtensionRegistry *reg, MultiGrammarConflictResult *result)
 Detect token-level conflicts across all loaded extensions.
 

Detailed Description

Scan loaded extensions for token, rule, and semantic conflicts.

Function Documentation

◆ detect_all_multi_grammar_conflicts()

bool detect_all_multi_grammar_conflicts ( struct ExtensionRegistry reg,
MultiGrammarConflictResult result 
)

#include <include/conflict.h>

Run a full multi-grammar conflict scan across all loaded extensions.

Walks every loaded extension's modifications and detects conflicts at all three levels (token, rule, semantic).

Parameters
regExtension registry with loaded extensions.
resultResult set to populate (must be pre-created).
Return values
trueAt least one conflict was detected.
falseNo conflicts found.

◆ detect_conflict()

ConflictPoint detect_conflict ( struct ExtensionRegistry reg,
uint16_t  token,
int  state 
)

#include <include/conflict.h>

Detect all levels of conflict for a specific token and state.

Convenience function that runs token, rule, and semantic detection and returns a single ConflictPoint summarizing all interpretations. If ncontexts > 1, the token is ambiguous.

Parameters
regExtension registry with loaded extensions.
tokenThe token code to check.
stateThe parser state to check (-1 for token-only check).
Returns
ConflictPoint (caller must call conflict_point_destroy()).

◆ detect_rule_conflicts()

uint32_t detect_rule_conflicts ( struct ExtensionRegistry reg,
uint16_t  token,
int  state,
MultiGrammarConflictResult result 
)

#include <include/conflict.h>

Detect rule-level conflicts for a given token and state.

Checks whether multiple extensions provide rules that could handle the specified token at the given state, creating a parse ambiguity.

Parameters
regExtension registry with loaded extensions.
tokenThe token code to check.
stateThe parser state to check.
resultResult set to populate (must be pre-created).
Returns
Number of rule-level conflicts found.

◆ detect_semantic_conflicts()

uint32_t detect_semantic_conflicts ( struct ExtensionRegistry reg,
uint16_t  token,
int  state,
MultiGrammarConflictResult result 
)

#include <include/conflict.h>

Detect semantic-level conflicts for a given token and state.

Checks whether multiple extensions provide different semantic actions for the same syntactic construct.

Parameters
regExtension registry with loaded extensions.
tokenThe token code to check.
stateThe parser state to check.
resultResult set to populate (must be pre-created).
Returns
Number of semantic-level conflicts found.

◆ detect_token_conflicts()

uint32_t detect_token_conflicts ( struct ExtensionRegistry reg,
MultiGrammarConflictResult result 
)

#include <include/conflict.h>

Detect token-level conflicts across all loaded extensions.

Scans the extension registry for loaded extensions whose modifications introduce tokens that collide (same name, different semantics).

Parameters
regExtension registry with loaded extensions.
resultResult set to populate (must be pre-created).
Returns
Number of token-level conflicts found.