Example #1
0
        static void Main(string[] args)
        {
            var grammar = LoadGrammar.LoadFromFile(@"./examples/ex2.json").ToGrammar();

            Console.WriteLine(grammar.ToString());
            LeftRecursionResolver.ResolveIndirectRecursion(grammar);
            LanguageUtils.RemoveLeftFactoring(grammar);
            LanguageUtils.RemoveEPS(ref grammar);
            Console.WriteLine(grammar.ToString());
            var parser = new LL1Parser(grammar);

            Console.WriteLine(parser.ProcessText("a + b cvcvx = ( b - c )"));
            parser.PrintTree(@"./tree.gv");
        }