예제 #1
0
        public static void ApplyMacros(INameLookup names, CatExpr fxns)
        {
            if (Config.gbShowRewritingRuleApplications)
            {
                Output.Write("Before rewriting: ");
                Output.WriteLine(fxns);
            }

            // repeat until a fix-point is reached (the algorithm converges)
            bool bDone = false;

            while (!bDone)
            {
                CatExpr original = fxns.Clone();
                ApplyMacrosInner(names, fxns);
                bDone = fxns.Equals(original);
            }

            if (Config.gbShowRewritingRuleApplications)
            {
                Output.Write("After rewriting: ");
                Output.WriteLine(fxns);
            }
        }