25 union {
int ival;
void *pval;
double dval; }
value;
32 struct { uint32_t first_line, first_column, last_line, last_column; } location;
43typedef int (*GLRDisambiguateFn)(uint32_t rule1_index, uint32_t rule2_index,
66GLRParser *glr_parser_create(uint32_t initial_state,
size_t arena_size);
69void glr_parser_destroy(
GLRParser *parser);
106int glr_parser_feed(
GLRParser *parser, uint16_t token,
107 const uint16_t *yy_action, uint32_t action_count,
108 const uint16_t *yy_lookahead, uint32_t lookahead_count,
109 const int16_t *yy_shift_ofst,
110 const int16_t *yy_reduce_ofst,
111 const uint16_t *yy_default,
113 const uint16_t *yy_rule_lhs,
114 const int8_t *yy_rule_nrhs,
116 uint16_t min_shiftreduce,
117 uint16_t max_shiftreduce,
120 uint16_t error_action,
121 uint16_t accept_action,
125void glr_parser_set_disambiguate(
GLRParser *parser,
126 GLRDisambiguateFn fn,
void *user_data);
129uint32_t glr_parser_head_count(
const GLRParser *parser);
132bool glr_parser_accepted(
const GLRParser *parser, uint16_t accept_action);
138void gss_node_release(
GSSNode *node);
GLR parser context, wrapping an underlying LALR(1) parser.
bool has_ambiguity
True if unresolved ambiguity detected.
void * disambiguate_data
User data for callback.
LimeArena * arena
Arena for GSSNode allocation.
uint32_t total_merges
Statistics: total merges.
uint32_t nheads
Number of active heads.
uint32_t max_heads
Capacity of active_heads.
GSSNode ** active_heads
Array of active stack top nodes.
GLRDisambiguateFn disambiguate
User disambiguation callback.
uint32_t total_forks
Statistics: total forks.
Graph-Structured Stack (GSS) node for GLR parsing.
uint32_t npred
Number of predecessors.
uint32_t refcount
Reference count.
struct GSSNode ** predecessors
Array of predecessor nodes.
uint32_t state
Parser state number.
uint32_t pred_capacity
Allocated predecessor slots.
union GSSNode::@0 value
Semantic value (one of int / pointer / double, by convention).
Arena allocator for AST nodes.