public SyntacticAnalysisCYK(GrammarFuzzy.Grammar grammar) : base(grammar, null, null) { List <Symbol> alphabet = new List <Symbol>(); alphabet.AddRange(grammar.Variables); alphabet.AddRange(grammar.Terminals); this.Grammar = grammar; // NormalFormChomsky nfc = new NormalFormChomsky(grammar); this.GrammarChomsky = grammar; }
public SyntacticAnalysisLR1(GrammarFuzzy.Grammar grammar, NormAbstract norm, ConormAbstract conorm) : base(grammar, norm, conorm) { CacheFirst = new Hashtable(); Table = new Dictionary<State<Symbol>, Dictionary<Symbol, List<Operation>>>(); //Rules = new List<RuleProductionState>(); List<Symbol> alphabet = new List<Symbol>(); alphabet.AddRange(grammar.Variables); alphabet.AddRange(grammar.Terminals); this.Grammar = grammar; GrammarLine = new GrammarFuzzy.Grammar(); GrammarLine.Rules.AddRange(grammar.Rules); GrammarLine.Terminals.AddRange(grammar.Terminals); GrammarLine.Variables.AddRange(grammar.Variables); GrammarLine.VariablesEmpty.AddRange(grammar.VariablesEmpty); SymbolInitialLine = new Symbol(100, "S'", false); GrammarLine.Variables.Add(SymbolInitialLine); GrammarLine.AddRule(SymbolInitialLine, grammar.VariableStart); GrammarLine.VariableStart = SymbolInitialLine; Automa = new Automa<Symbol>(alphabet, Symbol.EmptySymbol); SymbolInitial = grammar.VariableStart; CreateAutoma(); CreateTable(); }
public SyntacticAnalysisLR1(GrammarFuzzy.Grammar grammar, NormAbstract norm, ConormAbstract conorm) : base(grammar, norm, conorm) { CacheFirst = new Hashtable(); Table = new Dictionary <State <Symbol>, Dictionary <Symbol, List <Operation> > >(); //Rules = new List<RuleProductionState>(); List <Symbol> alphabet = new List <Symbol>(); alphabet.AddRange(grammar.Variables); alphabet.AddRange(grammar.Terminals); this.Grammar = grammar; GrammarLine = new GrammarFuzzy.Grammar(); GrammarLine.Rules.AddRange(grammar.Rules); GrammarLine.Terminals.AddRange(grammar.Terminals); GrammarLine.Variables.AddRange(grammar.Variables); GrammarLine.VariablesEmpty.AddRange(grammar.VariablesEmpty); SymbolInitialLine = new Symbol(100, "S'", false); GrammarLine.Variables.Add(SymbolInitialLine); GrammarLine.AddRule(SymbolInitialLine, grammar.VariableStart); GrammarLine.VariableStart = SymbolInitialLine; Automa = new Automa <Symbol>(alphabet, Symbol.EmptySymbol); SymbolInitial = grammar.VariableStart; CreateAutoma(); CreateTable(); }