Exemplo n.º 1
0
 public override AstNode Accept(AstVisitor visitor)
 {
     return visitor.Visit(this);
 }
Exemplo n.º 2
0
        public void LinkProgram()
        {
            // Read the result.
            AstNode content = moduleNode;

            // Perform semantic analysis passes.
            AstVisitor[] semanticPasses = new AstVisitor[] {
                // Declare module types.
                new ModuleTypeDeclaration(),

                // Expand using <namespaces>.
                new PseudoScopeExpansion(),

                // Expand type defs.
                new TypedefExpansion(),

                // Read the object bases.
                new ModuleReadBases(),

                // Declare module object(type members)
                new ModuleObjectDeclarator(),

                // Explicit interface member binding.
                new ExplicitInterfaceBinding(),

                // Build type inheritance tables.
                new ModuleInheritance(),

                // Perform function semantic analysis.
                new FunctionSemantic(),

                // Expand constants.
                new ConstantExpansion(),

                // Generate function byte code.
                new FunctionGenerator(),
            };

            // Execute passes.
            for(int i = 0; i < semanticPasses.Length; ++i)
            {
                AstVisitor pass = semanticPasses[i];
                pass.BeginPass();
                Benchmark.Begin();
                content.Accept(pass);
                Benchmark.End(pass.GetType().ToString());
                pass.EndPass();
            }
        }
Exemplo n.º 3
0
 public virtual AstNode Accept(AstVisitor visitor)
 {
     return visitor.Visit(this);
 }
Exemplo n.º 4
0
 public override AstNode Accept(AstVisitor visitor)
 {
     return(visitor.Visit(this));
 }