@light0x00/parser-generator
Version:
A Parser Generator
20 lines (19 loc) • 848 B
TypeScript
import { ASTree, ASTElement, ILexer } from "@light0x00/parser-definition";
import { Terminal, NonTerminal, Production, IGrammar, IParser, ActionGrammar } from "../Definition";
import { Stack } from "@light0x00/shim";
import { FirstTable } from "../First";
import { FollowSetTable } from "../Follow";
declare type ASTAccumulationEntry = {
astNode: ASTree;
accNum: number;
};
export declare class LLParser implements IParser {
startNT: NonTerminal;
firstTable: Map<string, Map<Terminal, Production>>;
followTable: Map<string, Set<Terminal>>;
constructor(grammar: IGrammar, firstTable: FirstTable, followTable: FollowSetTable);
accumulate(accStack: Stack<ASTAccumulationEntry>, ele?: ASTElement): void;
parse(lexer: ILexer): ASTree;
}
export declare function buildLLParser(grammar: ActionGrammar): LLParser;
export {};