Skip to content
Lucas Menezes edited this page Feb 8, 2018 · 12 revisions

Headache Compiler

HAC (Headache Compiler) is the compiler of the Headache Programming Language

Usage:

./hac [-option] file.ha [-O1]

HAC outputs the brainfuck code to a.bf. If the file contains errors, with syntax or semantics HAC will detect it and show an error message.

if used like this:

./hac [-option] [-O1]

HAC will read the program from stdin.

Optimization:

The default is -O0.

This line:

./hac file.ha

and this one:

./hac file.ha -O0

Have the same effect.

When -O1 is supplied, HAC will perform static constant arithmetic.

So having file.ha like this

void main() {
   @1+1+1;
}

Using:

./hac file.ha -O1

will actually compile this:

void main() {
   @3;
}

Options:

The options are: -check

Tells if file.ha has any semantic errors.

-syntax

Tells if file.ha conforms to Headache Syntax

-lex

Process tokens of file.ha

-tree

Outputs file.ha’s AST

Version and Help:

HAC also supports:

./hac --version

and

./hac --help

for user convenience