# A Compiler Switches

This appendix describes the available boolean switches, giving their name, their default setting, and their effects on the compilation process if they are set.

## Global Configuration

`\switch +``compilerpasses` (default: `false`)

  Output tracing information about the different phases the execution of each query proceeds through.

`\switch +``showinsert` (default: `false`)

  Show the names of files as they get inserted by the `\insert` macro directive, after their name has been resolved by means of the environment variable `OZPATH` (see Section 2.2).

`\switch +``echoqueries` (default: `true`)

  Output each (compilation) query verbatim.

`\switch +``showdeclares` (default: `true`)

  Summarize the variables declared by each query and thus added to the environment (provided the compilation succeeds and the compiled code is actually executed).

`\switch +``watchdog` (default: `true`)

  Terminate the current compilation if one of the compiler's threads blocks unexpectedly. This is useful for debugging the compiler.

## Warnings

`\switch +``warnredecl` (default: `false`)

  Output warnings about redeclarations of top-level variables, either by `declare` or locally.

`\switch +``warnunused` (default: `true`)

  Output warnings about local variables never used or used only once (that is, initialized but never used again).

`\switch +``warnunusedformals` (default: `false`)

  Output the above warnings also for formal parameters. If `\switch +``warnunused` is not set, this switch is ignored.

`\switch +``warnforward` (default: `false`)

  Warn about uses of features, attributes, or methods which are not known to be declared in the enclosing class.

`\switch +``warnopt` (default: `false`)

  Warn if a `case` conditional cannot be translated into optimized code. Also warn if a `cond` or disjunction's guard is translated with an explicit thread creation.

## I. Parsing and Expanding

`\switch +``unnest` (default: `true`)

  Enable unnesting. If unnesting is disabled, none of the following passes are executed either.

`\switch +``expression` (default: `false`)

  Compile expressions, not statements. The result of an evaluated expression can be obtained through an output argument of the enqueued query (see Section 4.3) or the variable ``result``.

`\switch +``allowdeprecated` (default: `true`)

  Allow the use of deprecated syntax, i. e., allow to use `case` for boolean conditionals and to mix `if` with `elsecase` and `case` with `elseif`.

`\switch +``gump` (default: `false`)

  Allow Gump definitions. If this switch is off, Gump keywords are parsed as ordinary atoms.

The remaining Gump-related switches are described in ``Gump - A Front-End Generator for Oz''.

## II. Static Analysis

`\switch +``staticanalysis` (default: `true`)

  Perform static analysis. Switching this off has severe impacts on optimization and error reporting.

## III. Core Output

`\switch +``core` (default: `false`)

  Output the result of the core expansion of a query.

`\switch +``realcore` (default: `false`)

  Output the core expansion as it really is (and not beautified by, e. g., the use of operator symbols).

`\switch +``debugvalue` (default: `false`)

  Include annotations about the values propagated by static analysis.

`\switch +``debugtype` (default: `false`)

  Include annotations about the types inferred by static analysis.

## IV. Code Generation

`\switch +``codegen` (default: `true`)

  Generate code.

`\switch +``outputcode` (default: `false`)

  Output the generated code as human-readable assembly code.

`\switch +``recordhoist` (default: `true`)

  Perform the record hoisting optimization.

## V. Feeding to the Emulator

`\switch +``feedtoemulator` (default: `true`)

  Load the generated code into the emulator and execute it.

`\switch +``threadedqueries` (default: `true`)

  Execute each piece of generated code in a separate thread without waiting for it to terminate before proceeding to the next query.

`\switch +``profile` (default: `false`)

  Include profiling information in the generated code.

## VI. Debugging

Most of these switches are used by the source level debugger, described in ``The Mozart Debugger''.

`\switch +``runwithdebugger` (default: `false`)

  Place a static breakpoint on the first statement of each compiled query.

Note that the following switches severely impact code size and run-time efficiency of the generated code.

`\switch +``controlflowinfo` (default: `false`)

  Include program flow information in the generated code.

`\switch +``staticvarnames` (default: `false`)

  Include environment information in the generated code.

`\switch +``dynamicvarnames` (default: `false`)

  All created local variables are annotated with their print name at run time, such that `System.printName` applied to the variable's value returns this name.