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

Create, share, and release parser snapshots. More...

Functions

ParserSnapshotlemon_snapshot_acquire (ParserSnapshot *snap)
 Acquire a reference to a snapshot.
 
ParserSnapshotlemon_snapshot_create (const char *grammar_file, char **error)
 Create a base snapshot by parsing a grammar file.
 
void lemon_snapshot_release (ParserSnapshot *snap)
 Release a snapshot reference.
 

Detailed Description

Create, share, and release parser snapshots.

Function Documentation

◆ lemon_snapshot_acquire()

ParserSnapshot * lemon_snapshot_acquire ( ParserSnapshot snap)

#include <include/parser.h>

Acquire a reference to a snapshot.

The caller must eventually call lemon_snapshot_release() to avoid leaking memory.

Parameters
snapSnapshot to acquire. Passing NULL is safe and returns NULL.
Returns
Same pointer as snap, for convenience.
See also
lemon_snapshot_release()

◆ lemon_snapshot_create()

ParserSnapshot * lemon_snapshot_create ( const char *  grammar_file,
char **  error 
)

#include <include/parser.h>

Create a base snapshot by parsing a grammar file.

Runs the Lime parser generator on grammar_file and produces a snapshot containing the compiled action tables.

Parameters
grammar_filePath to the grammar file.
[out]errorOn failure, set to a malloc'd message the caller must free. Set to NULL on success.
Returns
New snapshot with refcount 1, or NULL on failure.

◆ lemon_snapshot_release()

void lemon_snapshot_release ( ParserSnapshot snap)

#include <include/parser.h>

Release a snapshot reference.

When the last reference is released the snapshot and all memory it owns are freed.

Parameters
snapSnapshot to release. Passing NULL is safe.