Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
ParserSnapshot Struct Reference

Opaque snapshot handle. More...

Data Fields

uint16_t abi_version
 
uint32_t action_count
 Number of entries in yy_action.
 
ParserModule *uint64_t create_time_ns
 < Owning module metadata, or NULL
 
char * grammar_source
 Optional original grammar source text.
 
uint32_t grammar_source_len
 
LimeHostReduceFn host_reduce
 
void * host_reduce_user
 
void * jit_ctx
 JIT compilation context.
 
void * jit_find_shift_fn
 Cached pointer to the JIT'd jit_find_shift_action function, or NULL if no JIT is attached.
 
uint32_t lookahead_count
 Number of entries in yy_lookahead.
 
uint32_t magic
 Magic 'LIME' + ABI version stamped by snapshot_build_from_tables at construction time.
 
uint8_t merkle_root [32]
 Content hash of grammar data.
 
uint32_t nfallback
 Length of yy_fallback.
 
uint32_t nrule
 Total number of rules.
 
uint32_t nstate
 Total number of parser states.
 
uint32_t nsymbol
 Total number of symbols.
 
uint32_t nterminal
 Number of terminal symbols.
 
atomic_uint_fast32_t refcount
 Atomic reference count.
 
uint16_t reserved16
 Padding – next field is 8-byte aligned.
 
uint32_t reserved_pad
 Padding – atomics on next line.
 
uint32_t reserved_pad2
 Padding to 8-byte boundary.
 
uint32_t reserved_pad3
 
struct rule * rules
 Linked list of production rules.
 
struct state ** states
 Array of pointers to state structs.
 
struct symbol ** symbols
 Array of pointers to symbol structs.
 
char ** token_names
 
uint32_t token_names_count
 
uint64_t version
 Monotonically increasing version number.
 
uint16_t yy_accept_action
 Marker for parser accept.
 
uint16_t * yy_action
 Combined shift+reduce action array.
 
uint16_t * yy_default
 Default action for each state.
 
uint16_t yy_error_action
 Marker for syntax error.
 
uint16_t * yy_fallback
 Optional fallback table (length = nfallback, may be NULL).
 
uint16_t yy_first_token
 first_token directive value: subtracted from external token codes to get the internal action-table index.
 
uint16_t * yy_lookahead
 Lookahead values parallel to yy_action.
 
uint16_t yy_max_shift
 0..YY_MAX_SHIFT = shift to that state
 
uint16_t yy_max_shiftreduce
 Shift-reduce range maximum.
 
uint16_t yy_min_reduce
 Reduce range minimum (max = nstate+nrule)
 
uint16_t yy_min_shiftreduce
 Shift-reduce range minimum.
 
uint16_t yy_no_action
 Marker for unused slot.
 
uint16_t yy_ntoken
 Highest terminal code + 1.
 
int32_t * yy_reduce_ofst
 Per-state offset into yy_action for reduces.
 
int16_t * yy_rule_info_lhs
 LHS symbol code per rule.
 
int8_t * yy_rule_info_nrhs
 Negative number of RHS symbols per rule.
 
int32_t * yy_shift_ofst
 Per-state offset into yy_action for shifts.
 

Detailed Description

Opaque snapshot handle.

See src/snapshot.h for the full definition.

Definition at line 177 of file snapshot.h.

Field Documentation

◆ abi_version

uint16_t ParserSnapshot::abi_version

Definition at line 263 of file snapshot.h.

◆ action_count

uint32_t ParserSnapshot::action_count

Number of entries in yy_action.

Definition at line 219 of file snapshot.h.

◆ create_time_ns

ParserModule* uint64_t ParserSnapshot::create_time_ns

< Owning module metadata, or NULL

Nanosecond-precision wall-clock time when this snapshot was created.

Definition at line 306 of file snapshot.h.

◆ grammar_source

char* ParserSnapshot::grammar_source

Optional original grammar source text.

Populated by lime -n for snapshots produced via snapshot_build_from_tables(). NULL when the source is not retained.

Definition at line 296 of file snapshot.h.

◆ grammar_source_len

uint32_t ParserSnapshot::grammar_source_len

Definition at line 297 of file snapshot.h.

◆ host_reduce

LimeHostReduceFn ParserSnapshot::host_reduce

Definition at line 330 of file snapshot.h.

◆ host_reduce_user

void* ParserSnapshot::host_reduce_user

Definition at line 331 of file snapshot.h.

◆ jit_ctx

void* ParserSnapshot::jit_ctx

JIT compilation context.

Definition at line 309 of file snapshot.h.

◆ jit_find_shift_fn

void* ParserSnapshot::jit_find_shift_fn

Cached pointer to the JIT'd jit_find_shift_action function, or NULL if no JIT is attached.

Read FIRST in find_shift_action – taking the JIT path skips the rest of the snapshot reads. Type is uint32_t (*)(uint32_t state, uint32_t lookahead) – declared as void* so this header doesn't need to pull in jit_context.h.

Definition at line 194 of file snapshot.h.

◆ lookahead_count

uint32_t ParserSnapshot::lookahead_count

Number of entries in yy_lookahead.

Definition at line 218 of file snapshot.h.

◆ magic

uint32_t ParserSnapshot::magic

Magic 'LIME' + ABI version stamped by snapshot_build_from_tables at construction time.

Sanity-check before dereferencing. Mismatched magic = treat the pointer as garbage. Added v0.7.0.

Definition at line 262 of file snapshot.h.

◆ merkle_root

uint8_t ParserSnapshot::merkle_root[32]

Content hash of grammar data.

Definition at line 302 of file snapshot.h.

◆ nfallback

uint32_t ParserSnapshot::nfallback

Length of yy_fallback.

Definition at line 242 of file snapshot.h.

◆ nrule

uint32_t ParserSnapshot::nrule

Total number of rules.

Definition at line 220 of file snapshot.h.

◆ nstate

uint32_t ParserSnapshot::nstate

Total number of parser states.

Definition at line 221 of file snapshot.h.

◆ nsymbol

uint32_t ParserSnapshot::nsymbol

Total number of symbols.

Definition at line 286 of file snapshot.h.

◆ nterminal

uint32_t ParserSnapshot::nterminal

Number of terminal symbols.

Definition at line 287 of file snapshot.h.

◆ refcount

atomic_uint_fast32_t ParserSnapshot::refcount

Atomic reference count.

Starts at 1 on creation. Every call to snapshot_acquire() adds 1; every call to snapshot_release() subtracts

  1. When the count drops to 0 the snapshot is destroyed.

Definition at line 274 of file snapshot.h.

◆ reserved16

uint16_t ParserSnapshot::reserved16

Padding – next field is 8-byte aligned.

Definition at line 264 of file snapshot.h.

◆ reserved_pad

uint32_t ParserSnapshot::reserved_pad

Padding – atomics on next line.

Definition at line 243 of file snapshot.h.

◆ reserved_pad2

uint32_t ParserSnapshot::reserved_pad2

Padding to 8-byte boundary.

Definition at line 276 of file snapshot.h.

◆ reserved_pad3

uint32_t ParserSnapshot::reserved_pad3

Definition at line 298 of file snapshot.h.

◆ rules

struct rule* ParserSnapshot::rules

Linked list of production rules.

Definition at line 289 of file snapshot.h.

◆ states

struct state** ParserSnapshot::states

Array of pointers to state structs.

Definition at line 291 of file snapshot.h.

◆ symbols

struct symbol** ParserSnapshot::symbols

Array of pointers to symbol structs.

Definition at line 285 of file snapshot.h.

◆ token_names

char** ParserSnapshot::token_names

Definition at line 341 of file snapshot.h.

◆ token_names_count

uint32_t ParserSnapshot::token_names_count

Definition at line 342 of file snapshot.h.

◆ version

uint64_t ParserSnapshot::version

Monotonically increasing version number.

Each new snapshot produced from a grammar modification gets a higher version than the last.

Definition at line 269 of file snapshot.h.

◆ yy_accept_action

uint16_t ParserSnapshot::yy_accept_action

Marker for parser accept.

Definition at line 227 of file snapshot.h.

◆ yy_action

uint16_t* ParserSnapshot::yy_action

Combined shift+reduce action array.

Definition at line 196 of file snapshot.h.

◆ yy_default

uint16_t* ParserSnapshot::yy_default

Default action for each state.

Definition at line 206 of file snapshot.h.

◆ yy_error_action

uint16_t ParserSnapshot::yy_error_action

Marker for syntax error.

Definition at line 226 of file snapshot.h.

◆ yy_fallback

uint16_t* ParserSnapshot::yy_fallback

Optional fallback table (length = nfallback, may be NULL).

Definition at line 241 of file snapshot.h.

◆ yy_first_token

uint16_t ParserSnapshot::yy_first_token

first_token directive value: subtracted from external token codes to get the internal action-table index.

Zero when the grammar didn't declare first_token. Mirrors the YYFIRSTTOKEN define in generated parsers (limpar.c template).

Definition at line 235 of file snapshot.h.

◆ yy_lookahead

uint16_t* ParserSnapshot::yy_lookahead

Lookahead values parallel to yy_action.

Definition at line 197 of file snapshot.h.

◆ yy_max_shift

uint16_t ParserSnapshot::yy_max_shift

0..YY_MAX_SHIFT = shift to that state

Definition at line 223 of file snapshot.h.

◆ yy_max_shiftreduce

uint16_t ParserSnapshot::yy_max_shiftreduce

Shift-reduce range maximum.

Definition at line 225 of file snapshot.h.

◆ yy_min_reduce

uint16_t ParserSnapshot::yy_min_reduce

Reduce range minimum (max = nstate+nrule)

Definition at line 229 of file snapshot.h.

◆ yy_min_shiftreduce

uint16_t ParserSnapshot::yy_min_shiftreduce

Shift-reduce range minimum.

Definition at line 224 of file snapshot.h.

◆ yy_no_action

uint16_t ParserSnapshot::yy_no_action

Marker for unused slot.

Definition at line 228 of file snapshot.h.

◆ yy_ntoken

uint16_t ParserSnapshot::yy_ntoken

Highest terminal code + 1.

Definition at line 230 of file snapshot.h.

◆ yy_reduce_ofst

int32_t* ParserSnapshot::yy_reduce_ofst

Per-state offset into yy_action for reduces.

Same int32 reasoning as yy_shift_ofst above.

Definition at line 204 of file snapshot.h.

◆ yy_rule_info_lhs

int16_t* ParserSnapshot::yy_rule_info_lhs

LHS symbol code per rule.

Definition at line 207 of file snapshot.h.

◆ yy_rule_info_nrhs

int8_t* ParserSnapshot::yy_rule_info_nrhs

Negative number of RHS symbols per rule.

Definition at line 208 of file snapshot.h.

◆ yy_shift_ofst

int32_t* ParserSnapshot::yy_shift_ofst

Per-state offset into yy_action for shifts.

int32 (not int16) so grammars with action tables larger than 32k entries (e.g. PostgreSQL's ~145k-entry action table) can be represented without overflow. Memory cost on small grammars is at most 4 * nstate bytes; trivial.

Definition at line 198 of file snapshot.h.


The documentation for this struct was generated from the following file: