UNPKG

dotlr

Version:

An LR(1) parser generator and visualizer created for educational purposes.

161 lines (160 loc) 3.54 kB
/* tslint:disable */ /* eslint-disable */ /** * LR(1) or LALR(1) automaton of a grammar. */ export class Automaton { free(): void; } /** * First table of the symbols in a grammar. */ export class FirstTable { free(): void; } /** * Follow table of the symbols in a grammar. */ export class FollowTable { free(): void; } /** * Grammar of a language. */ export class Grammar { free(): void; /** * Creates a grammar from a grammar string (WASM). * @param {string} grammar_string * @returns {Grammar} */ static parse_wasm(grammar_string: string): Grammar; /** * Gets the symbols of the grammar (WASM). * @returns {any} */ symbols_wasm(): any; /** * Gets the start symbol of the grammar (WASM). * @returns {any} */ start_symbol_wasm(): any; /** * Gets the empty symbols of the grammar (WASM). * @returns {any} */ rules_wasm(): any; /** * Gets the constant tokens of the grammar (WASM). * @returns {string} */ to_string_wasm(): string; /** * Gets the regular expressions of the grammar (WASM). * @returns {any} */ constant_tokens_wasm(): any; /** * Gets the rules of the grammar (WASM). * @returns {any} */ regular_expressions_wasm(): any; /** * Clones the grammar (WASM). * @returns {Grammar} */ clone_wasm(): Grammar; } /** * LR(1) or LALR(1) parser of a grammar. */ export class Parser { free(): void; /** * Crates an LR(1) parser of a grammar (WASM). * @param {Grammar} grammar * @returns {Parser} */ static new_wasm(grammar: Grammar): Parser; /** * Crates an LALR(1) parser of a grammar (WASM). * @param {Grammar} grammar * @returns {Parser} */ static new_lalr_wasm(grammar: Grammar): Parser; /** * Gets the first table of the symbols in the grammar of the parser (WASM). * @returns {any} */ first_table_wasm(): any; /** * Gets the follow table of the symbols in the grammar of the parser (WASM). * @returns {any} */ follow_table_wasm(): any; /** * Gets the automaton of the grammar of the parser (WASM). * @returns {any} */ automaton_wasm(): any; /** * Gets the parsing tables of the parser (WASM). * @returns {any} */ parsing_tables_wasm(): any; /** * Gets the action table of the parser (WASM). * @returns {any} */ action_table_wasm(): any; /** * Gets the goto table of the parser (WASM). * @returns {any} */ goto_table_wasm(): any; /** * Tokenizes an input into a stream of tokens and their corresponding input slices (WASM). * @param {string} input * @returns {any} */ tokenize_wasm(input: string): any; /** * Parses a tokenized input (WASM). * @param {string} input * @returns {any} */ parse_wasm(input: string): any; /** * Traces the parsing of a tokenized input (WASM). * @param {string} input * @returns {any[]} */ trace_wasm(input: string): any[]; } /** * Action and goto tables of a parser. */ export class ParsingTables { free(): void; } /** * Parser error of a parser tried to be constructed from a grammar (WASM). */ export class WasmParserError { free(): void; /** * Prints the parser error to a string. * @returns {string} */ to_string_wasm(): string; /** * Serializes the parser error to a JavaScript value. * @returns {any} */ serialize(): any; /** * Converts the parser error to the conflicted parser if error was a conflict error. * @returns {Parser} */ into_conflict_parser(): Parser; }