minute read

Compiler

You are reading our Automation1 API documentation for the .NET programming language.

In the .NET API, Compiler lets you compile AeroScript source code into compiled AeroScript programs and compiled AeroScript libraries.

The Basics

In general, you do not need to use the Controller.Compiler property. If you want to run an AeroScript program, you can use the Controller.Runtime.Tasks.Program.Run method with either an AeroScript source file or a compiled AeroScript program. However, you can use the Controller.Compiler property to compile AeroScript programs ahead of time or to compile AeroScript libraries. See the Tasks page.

How to Use

When you compile AeroScript source with the Controller.Compiler property, you receive a CompiledAeroScript object. Unlike compiling in other programming languages, compiling AeroScript through the .NET API never writes the resulting compiled AeroScript to a file. Instead, you must write the bytes of the resulting compiled AeroScript program or AeroScript library to a file. Refer to the example that follows.

Copy
CompiledAeroScript controller.Compiler.CompileControllerFile(string controllerFileName);
CompiledAeroScript controller.Compiler.CompileTextAsLibrary(string textAeroScriptLibrarySource);
CompiledAeroScript controller.Compiler.CompileTextAsProgram(string textAeroScriptProgramSource);

You can use the CompiledAeroScript object with the Controller.Runtime.Tasks property to run the resulting compiled AeroScript program. Or you can write the compiled result to a controller file by using the Controller.Files property and the CompiledAeroScript.CompiledBytes property. See the Files page.

Thread Safety

All the methods and properties that operate under the Controller.Compiler property are thread safe. You can call them from two or more threads without interference.

All the methods and properties on the CompiledAeroScript class are thread safe. You can call them from two or more threads without interference.

Full Reference

For more information about the methods that are available for Compiler, refer to the list that follows.

Controller.Compiler Methods