public static void DigraphMethods() { var grammar = GallierCalc.GetGrammar(); var analyzer = Analyzers.CreateErasableSymbolsAnalyzer(grammar); (var initfirstSets, IGraph graphFirst) = DigraphAlgorithm.GetFirstGraph(grammar, analyzer); SaveFile("FirstGraph.dot", DigraphDotLanguagePrinter.PrintGraph("INITFIRST", initfirstSets, graphFirst, v => grammar.Nonterminals[v].Name)); var firstSymbolsAnalyzer = Analyzers.CreateFirstSymbolsAnalyzer(grammar); (var initFollowSets, IGraph graphFollow) = DigraphAlgorithm.GetFollowGraph(grammar, firstSymbolsAnalyzer); SaveFile("FollowGraph.dot", DigraphDotLanguagePrinter.PrintGraph("INITFOLLOW", initFollowSets, graphFollow, v => grammar.Nonterminals[v].Name)); }
public GallierDigraphMethodTests() { Grammar = GallierCalc.GetGrammar(); }
public DragonBookAnalyzerTests() { Grammar = GallierCalc.GetGrammar(); }
public DigraphAlgorithmTests() { Grammar = GallierCalc.GetGrammar(); }
public void CreateFollowResult() { var grammar = GallierCalc.GetGrammar(); grammar.PrintFirstAndFollowSets(new TestWriter()); }