UNPKG

1.05 kBTypeScriptView Raw
1import * as frontend from 'llparse-frontend';
2import source = frontend.source;
3import { ICompilerOptions, ICompilerResult } from './compiler';
4export { source, ICompilerOptions, ICompilerResult };
5/**
6 * LLParse graph builder and compiler.
7 */
8export declare class LLParse extends source.Builder {
9 private readonly prefix;
10 /**
11 * The prefix controls the names of methods and state struct in generated
12 * public C headers:
13 *
14 * ```c
15 * // state struct
16 * struct PREFIX_t {
17 * ...
18 * }
19 *
20 * int PREFIX_init(PREFIX_t* state);
21 * int PREFIX_execute(PREFIX_t* state, const char* p, const char* endp);
22 * ```
23 *
24 * @param prefix Prefix to be used when generating public API.
25 */
26 constructor(prefix?: string);
27 /**
28 * Compile LLParse graph to the bitcode and C headers
29 *
30 * @param root Root node of the parse graph (see `.node()`)
31 * @param options Compiler options.
32 */
33 build(root: source.node.Node, options?: ICompilerOptions): ICompilerResult;
34}