@fauton/cfg
Version:
A package to work with context free grammars and LL1 parsers
13 lines (12 loc) • 552 B
TypeScript
import { IContextFreeGrammar } from "./types";
export interface VariableReferenceLocation {
variable: string;
ruleNumber: number;
tokenNumber: number;
}
/**
* Return a record providing details of the location of each variable of the cfg
* @param cfg Input context free grammar
* @returns A record which provides info regarding the location of a variable
*/
export default function generateVariableReferenceRecord(cfg: Pick<IContextFreeGrammar, "productionRules" | "variables">): Record<string, VariableReferenceLocation[]>;