Next: , 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 and exit.

— 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:

Dialect flags (for ACT-compatibility):

ACT is a preset that activates all ACT-mode flags for compatibility.

The following options are forwarded to the create-phase of compilation by the driver. That is, they do not have any affect until the create phase. These options must be specified up-front at compile-time and cannot be overriden at create-time on the command line.

— 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.

— User Option: -v

Show version and build information and exit.

haco is provided as a single-command alias to hackt compile1.

TODO: quick explanation of parse errors.


Footnotes

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