alice
manual.


Alice Project

batch
compiler


________ Overview ____________________________________________________

The standalone batch compiler is used to produce components from source files.

________ Synopsis ____________________________________________________

alicec [<options>] [-c] <input file> [-o <output file>] [<input file> [-o <output file>] ...]
alicec [<options>] -r <input file> [-o <output file>] [<input file> [-o <output file>] ...]

________ Description _________________________________________________

All <input file>s are compiled as Alice source programs and corresponding components are written as output. If <output file> is given after an <input file>, it is used as the respective output file name, else the basename of <input file> is used with .alc as extension. Compiled components can be executed by invoking the virtual machine.

An <input file> may be a URL. See below for notes on how they are interpreted. An <output file> may only be omitted if the preceding <input file> represents a local file.

To compile a component, the compiler requires access to all imported component files whose import signature omit type information in the source file. If one does not exist, but a source file for it (i.e., a file with same name but ending in .aml, .sml, or .sig) can be located, the compiler first invokes itself recursively to compile the imported component. If a component does exist, the compiler does not perform any check to verify whether it is up-to-date. External tools like make have to be used, in conjunction with the dependency analyzer, to ensure proper recompilation if necessary.

Smart Recompilation

Invoking the compiler with option -r instead of -c enables smart recompilation. When the compiler is initiated in this mode, the output component is only created when it does not exist yet, or is out of date.

The target component file is considered out of date if either of the following holds:

The smart recompilation mode is particularly useful in conjunction with tools like make. It avoids redundant regeneration of existing target files and hence can cut off subsequent recompilation further down the dependency chain. To take advantage of this, simply invoke the Alice compiler in smart recompilation mode in your Makefile and the tool figures out the rest by itself. You do not need to modify dependencies declarations (like e.g. generated by the dependency analyzer for Alice).


________ Options _____________________________________________________

--version

Print compiler version.

--assert <level>

Set assertion level (0 by default).

--(no-)dump-phases

Trace compilation phases.

--(no-)dump-elaboration-sig

Output component's export signature.

--(no-)warn-unused-imports

Warn about unused imports (on by default).

--(no-)warn-added-imports

Warn about imports inserted by the compiler for closing over implicit import signatures (off by default).

--(no-)warn-inaccessible-exports

Warn about local types occuring in the computed export signature of the component, as they will prevent the component being imported in full (on by default).

--(no-)warn-conventions

Warn about violations of standard naming conventions (on by default).

--(no-)warn-shadowing

Warn about shadowing of identifiers (off by default, gives a lot of spurious warnings).

--(no-)recursive-compilation

Recursively compile imports if they do not exist in compiled form yet (does not perform any up-to-date checks!).

--dependency-file <dependency file>

Use dependency file to automatically derive import announcements.

--annotations-file <annotations file>

Write type information to a file for use by external tools, e.g. smart editors.

-z, --minimize

Minimize output component.


________ Import management ___________________________________________

Alice employs a compilation model that is quite different from other Standard ML systems. In particular, Alice ML requires putting explicit import announcements into source files to enable separate compilation.

In order to allow for easier migration or sharing of SML source code with other SML systems, the Alice compiler supports two methods for inserting import announcements automatically:

The first of these options essentially requires creating a separate import file for each individual SML file. The second option allows gathering all the necessary information into a single dependency file.

Please note that these methods are provided solely for better compatibility with other SML systems. Using them for native Alice components is strongly discouraged.

Depending on the structure of the sources, using a dependency file may yield a lot of spurious "unused import" warnings, because it invariably inserts imports for all entities defined on the top-level of a source file. You may want to use the --no-warn-unused-imports flag to avoid this.


________ Environment variables _______________________________________

The batch compiler is parameterized by the same environment variables as the virtual machine, plus:

ALICE_SOURCE_PATH

specifies how source file URLs are interpreted. If set, the value of this environment variable is parsed by the parse method of the Resolver.Handler structure. If not set, uses only the default identity method.



last modified 2007/02/11 15:58