Compile - HACKT Tutorials
Description: HACKT Tutorials

Next: Preprocessor, Up: Compiler

### 2.1 Compile

The first compile phase produces a parsed and partially checked object file given an input text (source) file.

— Program: haco [options] source object

> Compile HAC source to object file.

The source file is a text file in the HAC language. The object file, if given, is the result of the compile. If the object file is omitted, the program just reports the result of complation without producing an object file.

Options:

— User Option: -h

> Show usage.

— User Option: -I path

> Adds include path path for importing other source files (repeatable).

— User Option: -d

> Produces text dump of compiled module, like hacobjdump in Objdump.

— User Option: -f optname

> general compile flags (repeatable) where optname is one of the following:

> - dump-include-paths: dumps -I include paths as they are processed
> - dump-object-header: (diagnostic) dumps persistent object header before saving
> - no-dump-include-paths: suppress feedback of -I include paths
> - no-dump-object-header: suppress persistent object header dump

> Dialect flags (for ACT-compatbility):

> - export-all: Treat all definitions as exported, i.e. no export checking.
> - export-strict: Check that definitions are exported for use outside their respective home namespaces (default, ACT).
> - namespace-instances Allow instance management outside global namespace (default). Negatable with `no-` prefixed. ACT mode: no-namespace-instances.
> - array-internal-nodes Allow implicit arrays of internal nodes in PRS (default). Negatable with `no-` prefixed. ACT mode: no-array-internal-nodes.
> ACT is a preset that activates all ACT-mode flags for compatibility.

— User Option: -M depfile

> Emit import dependencies in file depfile as a side-effect. Useful for automatic dynamic dependency-tracking in Makefiles.

— User Option: -o objfile

> Names objfile as the output object file to save. This is an alternative to naming the object file as the second non-option argument.

— User Option: -p

> Expect input to be piped from stdin rather than a named file. Since the name of the input file is omitted in this case, the only non-option argument (if any) is interpreted as the name of the output object file.

`haco` is provided as a single-command alias to `hackt compile`1.

TODO: quick explanation of parse errors.

#### Footnotes

[1] Thus named because we use `.haco` as the extension for compiled object files