Ejemplo n.º 1
0
        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();
 }
Ejemplo n.º 3
0
 public DragonBookAnalyzerTests()
 {
     Grammar = GallierCalc.GetGrammar();
 }
Ejemplo n.º 4
0
 public DigraphAlgorithmTests()
 {
     Grammar = GallierCalc.GetGrammar();
 }
        public void CreateFollowResult()
        {
            var grammar = GallierCalc.GetGrammar();

            grammar.PrintFirstAndFollowSets(new TestWriter());
        }