@fauton/cfg
Version:
A package to work with context free grammars and LL1 parsers
14 lines (13 loc) • 873 B
TypeScript
import { IContextFreeGrammar, IContextFreeGrammarInput } from './types';
export declare function createProductionCombinations(substitution: string, epsilonProducingVariable: string, productionRuleVariable: string): readonly [string[], boolean, number];
/**
* Adds epsilon to production rules that references nullable variables
* @param cfg Variables array and production rules record of cfg
*/
export declare function findNullableVariables(cfg: Pick<IContextFreeGrammar, 'variables' | 'productionRules'>): string[];
/**
* Removes all the null production and returns a new transition record
* @param cfg Variables and transition record for cfg
* @returns New transition record with null production removed
*/
export declare function removeNullProduction(inputCfg: Pick<IContextFreeGrammarInput, 'variables' | 'productionRules' | 'startVariable'>): void;