Elements Technologies

Elements Compiler

Mix languages in one project and compile for the platform you need.

How the compiler works

The compiler is at the center of the Elements toolchain. It takes the source files in a project and generates code for the platform you’re building for. That can mean managed assemblies for .NET, bytecode for Java or Android, native object files for the linker, or WebAssembly.

Elements separates the parts of the compiler that understand source languages from the parts that understand target platforms. This lets the same language front end work with different back ends, and lets a single project bring several languages together.

Front ends read your source files

Elements has a front end for each of its eight languages. The compiler picks one by file extension, so a project can contain Oxygene .pas files, C# .cs files, Swift .swift files, or any other Elements language the target supports.

A front end understands its language’s syntax and turns the source into the compiler’s internal form. Elements can also process XAML markup as part of applicable .NET projects.

The compiler combines the source files into one language-independent code tree. Types and members from different languages are visible to one another in that tree. An Oxygene class can call a C# method or inherit from a Swift class in the same project, without a separate build or a foreign-language bridge.

Back ends generate code for the target

Each target within a project selects one back end. It receives the shared code tree and generates the output for that target, regardless of which front end read each file. In a project with multiple targets, each target can select its own back end and use the source files and references appropriate to that platform.

From source to a deliverable

EBuild prepares the project for compilation by selecting the SDK and resolving references. After compilation, it runs the steps needed for that target, such as linking native object files into an executable, processing resources, or packaging an app bundle.

See the compiler documentation  for options and command-line usage.