Comment on page
The Dyvil Compiler
The Dyvil Compiler is the main tool for converting Dyvil source files to Class Files and Dyvil Object Files.
The following file types can be processed by the Dyvil Compiler:
.dyvil- Dyvil Classes, compiled to the Java Class File format (
.dyvilh- Dyvil Headers, compiled to Dyvil Object Files (
.jar- compiled Java or Dyvil Libraries, container files for
In order to tell the compiler where to find source files and libraries, there are two options:
When running the compiler via the command line, it is possible to pass space-separated arguments to it, as shown in the below example:
dyvilc compile source_dir=src output_dir=bin ...
Note that there are four types of arguments that can be passed:
- 1.Phase Arguments - These simple arguments tell the compiler which work it you want it to do. The following phase arguments are available:
compile- Performs the usual compilation steps, without any optimisations or constant folding.
optimise- Performs optimisations, with
1constant folding iteration
-oN- Performs optimisations, where
Nis the number of constant folding iterations
jar- Generates a Jar file from the source files. File names and other versioning information can be set via the corresponding options.
format- Formats the source files according to the recommended Dyvil code style
clean- Cleans the output directory before compilation, deleting all binaries
formatis passed as well
test- runs the Main Type with the specified Main Arguments
- 2.Debug Arguments
--debug- enables both
test, and enables advanced logging output
@configfile.txt- loads the Compiler Configuration file from the path after the
@symbol (relative to the directory from which the compiler was launched)
option=value- sets the value of the option named
value. Possible options are listed below.
Please note that it is currently not possible to pass list options like
libraries=[libs/,...]as main arguments. However, it is possible to include multiple libraries into compilation by adding more arguments:
dyvilc libraries=libs/asm.jar libraries=libs/guava.jar
A command line argument starting with
@is treated by the compiler as the path for a configuration file.
dyvilc compile @config.dyc
This command will load all options from the
config.dycfile, which is resolved relative to the directory from which the compiler has been launched. Note that it is only possible to define options in the configuration file. Other compiler arguments such as
jar, debug arguments and optimisation settings have to be passed directly as launch arguments.
The config file has a format like this
option = value
listOption = [ value1, value2, ... ]
By convention, the file should use the
Dyvil Config). Other file extensions like
.txtare also accepted by the compiler.
The following options can be passed as launch arguments or in the configuration file:
- The file options
librariesare relative to the launch directory of the compiler.
excludeoptions are both relative to the source directory roots.
- All file names are separated with
/, but the file separator of the host system (e.g.
\on Windows) is also supported.
- The main type is separated with
., as usual for Dyvil and Java class names.