cfg-first-follow
Version:
Calculate FIRST and FOLLOW set of a Context Free Grammar symbol
15 lines • 642 B
TypeScript
import type { ContextFreeGrammar, NonTerminalSymbol, TerminalSymbol } from './typings';
export declare class Parser {
#private;
constructor(grammar: ContextFreeGrammar);
get grammar(): ContextFreeGrammar;
get nonTerminals(): Set<string>;
get terminals(): Set<string | null>;
/**
* Finds the `FIRST` set of a given grammar symbol.
* @param symbol The grammar symbol whose `FIRST` set is to be calculated
*/
first(symbol: TerminalSymbol | NonTerminalSymbol): Set<TerminalSymbol | null>;
follow(symbol: TerminalSymbol | NonTerminalSymbol): void;
}
//# sourceMappingURL=parser.d.ts.map