public void DragonBookEx4_54()
        {
            var grammar = DragonBookExample4_54.GetGrammar();

            var writer = new TestWriter();

            var lr0Parser = grammar.ComputeLr0ParsingTable();

            WriteLine("LR(0) Parsing Table");
            lr0Parser.PrintParsingTable(writer);

            // The grammar is LR(0)
            lr0Parser.AnyConflicts.ShouldBeFalse();

            var slrParser = grammar.ComputeSlrParsingTable();

            WriteLine("SLR(1) Parsing Table");
            slrParser.PrintParsingTable(writer);

            // The grammar is SLR(1)
            slrParser.AnyConflicts.ShouldBeFalse();

            var lr1Parser = grammar.ComputeLr1ParsingTable();

            WriteLine("LR(1) Parsing Table");
            lr1Parser.PrintParsingTable(writer);

            // The grammar is LR(1)
            lr1Parser.AnyConflicts.ShouldBeFalse();

            // dccd
            var lexer = new FakeLexer <Sym>((Sym.d, "d"), (Sym.c, "c"), (Sym.c, "c"), (Sym.d, "d"));

            lr1Parser.Parse(lexer, writer);
        }
        public static void DragonBookEx4_54()
        {
            var grammar = DragonBookExample4_54.GetGrammar();

            var dfaLr0 = grammar.GetLr0AutomatonDfa();

            SaveFile("DragonBookEx4_54_DCG0Lr.dot", DotLanguagePrinter.ToDotLanguage(dfaLr0, DotRankDirection.LeftRight, skipStateLabeling: true));

            var dfaLr1 = grammar.GetLr1AutomatonDfa();

            SaveFile("DragonBookEx4_54_DCG1Lr.dot", DotLanguagePrinter.ToDotLanguage(dfaLr1, DotRankDirection.LeftRight, skipStateLabeling: true));
        }