예제 #1
0
        public override object VisitProgNode(ProgNode n)
        {
            var globdefs   = new List <ASTNode>(n.children.Count);
            var enumdefs   = new List <ASTNode>(n.children.Count);
            var structdefs = new List <ASTNode>(n.children.Count);
            var fundefs    = new List <ASTNode>(n.children.Count);
            var rest       = new List <ASTNode>(n.children.Count);

            foreach (var c in n.children)
            {
                switch (c.kind)
                {
                case ASTKind.GlobalVarDef:
                    globdefs.Add(c);
                    break;

                case ASTKind.EnumDef:
                    enumdefs.Add(c);
                    break;

                case ASTKind.StructDef:
                    structdefs.Add(c);
                    break;

                case ASTKind.FunDef:
                    fundefs.Add(c);
                    break;

                default:
                    rest.Add(c);
                    break;
                }
            }

            foreach (ASTNode c in globdefs)
            {
                Visit(c);
            }
            foreach (ASTNode c in enumdefs)
            {
                Visit(c);
            }
            foreach (ASTNode c in structdefs)
            {
                Visit(c);
            }
            foreach (ASTNode c in fundefs)
            {
                Visit(c);
            }
            foreach (ASTNode c in rest)
            {
                Visit(c);
            }

            return(null);
        }
예제 #2
0
        public virtual T VisitProgNode(ProgNode n)
        {
            foreach (var c in n.children)
            {
                Visit(c);
            }

            return(default(T));
        }
예제 #3
0
        public object VisitProgNode(ProgNode n)
        {
            WriteLine(n.kind);

            Indent();
            foreach (ASTNode c in n.children)
            {
                Visit(c);
            }
            Dedent();

            return(null);
        }
예제 #4
0
 public override MIPSRegister VisitProgNode(ProgNode n)
 {
     return(base.VisitProgNode(n));
 }
예제 #5
0
 public override LLVMRegister VisitProgNode(ProgNode n)
 {
     throw new NotImplementedException();
 }