예제 #1
0
        static void Main(string[] args)
        {
            var cu = ParseFile(@"D:\PascalABC.NET\!PABC_Git\Yield\tests\basic\yieldSimpleMethodDef.pas");
            if (cu == null)
                return;

            var yieldVis = new ProcessYieldCapturedVarsVisitor();
            cu.visit(yieldVis);


            cu.visit(new SimplePrettyPrinterVisitor());

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            var cu = ParseFile(@"C:\Users\Oleg\Documents\Visual Studio 2015\Projects\C#\Compilers\PascalABC.NET_Diplom\Yield\tests\template\yieldSimpleTemplateWithField.pas");
            if (cu == null)
                return;

            var yieldVis = new ProcessYieldCapturedVarsVisitor();
            cu.visit(yieldVis);


            cu.visit(new SimplePrettyPrinterVisitor());

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            var cu = ParseFile(@"C:\Users\Oleg\Documents\Visual Studio 2015\Projects\C#\Compilers\_ParsePABC1\tests\yield9.pas");
            if (cu == null)
                return;

            //var refsReplacer = new ReplaceFormalParametersRefsVisitor();
            //cu.visit(refsReplacer);

            //var lowVis = new LoweringVisitor();
            //cu.visit(lowVis);

            //var ugVis = new CollectUnitGlobalsVisitor();
            //cu.visit(ugVis);
            //Console.WriteLine(ugVis.CollectedGlobals);

            //JustTestVisitor jtVis = new JustTestVisitor();
            //cu.visit(jtVis);

            var yieldVis = new ProcessYieldCapturedVarsVisitor();
            cu.visit(yieldVis);

            //CodeFormatters.CodeFormatter cf = new CodeFormatters.CodeFormatter(0);
            //txt = cf.FormatTree(txt, cu as compilation_unit, 0, 0);

            //cu.visit(new ChangeWhileVisitor());
            //cu.visit(new DeleteRedundantBeginEnds());

            /*cu.visit(new CollectUpperNamespacesVisitor());

            var allv = new AllVarsInProcYields();
            cu.visit(allv);
            allv.PrintDict();*/

            /*var cnt = new CountNodesVisitor();
            cu.visit(cnt);
            cnt.PrintSortedByValue();*/

            /*var ld = new HashSet<string>();
            ld.Add("p1");
            var dld = new DeleteLocalDefs(ld);
            cu.visit(dld);*/

            cu.visit(new SimplePrettyPrinterVisitor());

            Console.ReadKey();
        }