|
Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
|
Build a runtime ParserSnapshot from generated parser tables. More...
#include "snapshot.h"Go to the source code of this file.
Data Structures | |
| struct | LimeParserTables |
| Bundle of pointers + sizes the generator emits for a parser. More... | |
Macros | |
| #define | LIME_TABLES_ABI_VERSION 1 |
| #define | LIME_TABLES_MAGIC 0x4C494D45U /* 'L','I','M','E' */ |
Functions | |
| ParserSnapshot * | snapshot_build_from_tables (const LimeParserTables *tables) |
| Build a fresh ParserSnapshot from a LimeParserTables bundle. | |
Build a runtime ParserSnapshot from generated parser tables.
A Lime-generated parser contains everything needed to drive an LALR(1) parse: action tables, rule metadata, and the constants that partition the action range into shifts / reduces / errors. The generator emits these as static arrays inside the parser .c file.
This header provides the bridge that lets a generated parser hand those tables to the runtime so the runtime push parser (parse_begin / parse_token / parse_end) and the JIT can drive them.
Two ways to use this:
lime -n foo.y to produce a *_snapshot.c file, compiles it, dlopens it, and calls the registration entry point below. Used for true runtime grammar loading.The snapshot returned takes a shared reference to the static tables – it does not free them – so the same generated parser can be used by many concurrent ParseContext instances. When extensions mutate the snapshot via apply_modification, the snapshot's tables are first deep-copied; the originals stay untouched.
Definition in file snapshot_build.h.
| #define LIME_TABLES_ABI_VERSION 1 |
Definition at line 139 of file snapshot_build.h.
| #define LIME_TABLES_MAGIC 0x4C494D45U /* 'L','I','M','E' */ |
Definition at line 138 of file snapshot_build.h.
| ParserSnapshot * snapshot_build_from_tables | ( | const LimeParserTables * | tables | ) |
Build a fresh ParserSnapshot from a LimeParserTables bundle.
The snapshot deep-copies the action tables and rule metadata so that subsequent extension modifications do not touch the static generator-emitted arrays. Returns a snapshot with refcount 1, or NULL on allocation failure.
| tables | Compile-time table bundle from a generated parser. |