Beispiel #1
0
 public IodineModule CompileAst(IodineModule module, AstRoot ast)
 {
     ModuleCompiler compiler = new ModuleCompiler (errorLog, symbolTable, module);
     ast.Visit (compiler);
     module.Initializer.FinalizeLabels ();
     optimizeObject (module);
     return module;
 }
Beispiel #2
0
        public override void Accept(ClassDeclaration classDecl)
        {
            ModuleCompiler compiler = new ModuleCompiler(symbolTable, methodBuilder.Module);
            IodineClass    clazz    = compiler.CompileClass(classDecl);

            methodBuilder.EmitInstruction(classDecl.Location, Opcode.LoadConst,
                                          methodBuilder.Module.DefineConstant(clazz));
            methodBuilder.EmitInstruction(classDecl.Location, Opcode.StoreLocal,
                                          symbolTable.GetSymbol(classDecl.Name).Index);
        }
		public IodineModule Compile (string moduleName)
		{
			IodineModule module = new IodineModule (moduleName);

			ModuleCompiler compiler = new ModuleCompiler (symbolTable, module);
			root.Visit (compiler);
			module.Initializer.FinalizeLabels ();
			if (context.ShouldOptimize) {
				OptimizeObject (module);
			}
			return module;
		}
Beispiel #4
0
        public IodineModule Compile(string moduleName)
        {
            IodineModule module = new IodineModule(moduleName);

            ModuleCompiler compiler = new ModuleCompiler(symbolTable, module);

            root.Visit(compiler);
            module.Initializer.FinalizeLabels();
            if (context.ShouldOptimize)
            {
                OptimizeObject(module);
            }
            return(module);
        }
		public override void Accept (ClassDeclaration classDecl)
		{
			ModuleCompiler compiler = new ModuleCompiler (symbolTable, methodBuilder.Module);
			IodineClass clazz = compiler.CompileClass (classDecl);
			methodBuilder.EmitInstruction (classDecl.Location, Opcode.LoadConst,
				methodBuilder.Module.DefineConstant (clazz));
			methodBuilder.EmitInstruction (classDecl.Location, Opcode.StoreLocal,
				symbolTable.GetSymbol (classDecl.Name).Index);
		}