Пример #1
0
        static bool debug_new_shit(string text)
        {
            var root = BuildAST_Cool.BUILD(text);
            var v0   = new CheckIDSandTypeDecVisitor();

            return(v0.Visit(root));

            bool r = true;

            try
            {
                r = v0.Visit(root);
                Console.WriteLine(r);
            }
            catch (Exception)
            {
                Console.WriteLine("Se partio debug shit");
            }
            Console.WriteLine(r + "shit");
            return(r);
        }
Пример #2
0
        public static Tuple <bool, ErrorLoger> SemanticChecking(Cool_Compiler.AST.AST_Root root)
        {
            var v0 = new CheckIDSandTypeDecVisitor();

            if (v0.Visit(root))
            {
                var v1 = new CheckClassesVisitor();
                if (v1.Visit(root))
                {
                    var v2 = new CheckVariablesVisitor();
                    if (v2.Visit(root))
                    {
                        var v3 = new CheckTypesVisitor();
                        if (v3.Visit(root))
                        {
                            return(new Tuple <bool, ErrorLoger>(true, null));
                        }
                        else
                        {
                            return(new Tuple <bool, ErrorLoger>(false, v3.CurrErrorLoger));
                        }
                    }
                    else
                    {
                        return(new Tuple <bool, ErrorLoger>(false, v2.CurrErrorLoger));
                    }
                }
                else
                {
                    return(new Tuple <bool, ErrorLoger>(false, v1.CurrErrorLoger));
                }
            }
            else
            {
                return(new Tuple <bool, ErrorLoger>(false, v0.CurrErrorLoger));
            }
        }