UNPKG

@fauton/cfg

Version:

A package to work with context free grammars and LL1 parsers

29 lines (28 loc) 939 B
export interface IContextFreeGrammar { variables: string[]; terminals: string[]; productionRules: Record<string, string[]>; startVariable: string; } export interface IContextFreeGrammarInput { variables?: string[] | null; terminals?: string[] | null; productionRules: Record<string, string[]>; startVariable?: string; } export declare type LanguageChecker = (inputString: string) => boolean; export interface ICfgLanguageGenerationOption { minTokenLength: number; maxTokenLength: number; skipSimplification?: boolean; skipValidation?: boolean; generateTerminals?: boolean; generateVariables?: boolean; autoCapitalizeFirstToken?: boolean; useSpaceWhenJoiningTokens?: boolean; parseDirection?: 'left' | 'right'; } export declare type ParseTree = { [k: string]: (string | ParseTree)[]; }; export declare type Derivation = [string, string[]];