Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1
35#ifndef PARSER_H
36#define PARSER_H
37
38#include <stdbool.h>
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
49const char *lemon_parser_version(void);
50
51/* --- Snapshot API -------------------------------------------------- */
52
63typedef struct ParserSnapshot ParserSnapshot;
64
77
87
99ParserSnapshot *lemon_snapshot_create(const char *grammar_file, char **error);
100
/* end snapshot_api */
102
103/* --- Parse Context API ----------------------------------------------- */
104
115typedef struct ParseContext ParseContext;
116
128
146 int token_code,
147 void *token_value,
148 int location);
149
158
166
/* end parse_ctx_api */
168
169/* --- JIT Compilation API ----------------------------------------- */
170
183
192
/* end jit_api */
194
195/* --- Extension API ------------------------------------------------ */
196
213
220
/* end ext_init */
222
223#ifdef __cplusplus
224}
225#endif
226
227#endif /* PARSER_H */
void lemon_extension_registry_destroy(void)
Destroy the global extension registry.
bool lemon_extension_registry_init(void)
Initialize the global extension registry.
bool lime_jit_available(void)
Check whether JIT compilation support is available at runtime.
int lime_jit_compile(ParserSnapshot *snap)
Compile and attach JIT code to a snapshot's action tables.
int parse_token(ParseContext *ctx, int token_code, void *token_value, int location)
Feed a token to the parser.
ParseContext * parse_begin(ParserSnapshot *snap)
Begin a parse session pinned to a snapshot.
void parse_end(ParseContext *ctx)
End the parse session.
ParserSnapshot * parse_get_snapshot(ParseContext *ctx)
Return the snapshot pinned by this context.
ParserSnapshot * lemon_snapshot_acquire(ParserSnapshot *snap)
Acquire a reference to a snapshot.
void lemon_snapshot_release(ParserSnapshot *snap)
Release a snapshot reference.
ParserSnapshot * lemon_snapshot_create(const char *grammar_file, char **error)
Create a base snapshot by parsing a grammar file.
const char * lemon_parser_version(void)
Return the Lime parser library version string.
Per-parse-session state.
Opaque snapshot handle.
Definition snapshot.h:117