-
Notifications
You must be signed in to change notification settings - Fork 0
Compiler
jbw3 edited this page Apr 17, 2021
·
10 revisions
The compiler executable is wip.
Usage: wip <filenames> [options]
The following options are supported:
-h, --help Print help message
--arch <value> Assembly architecture
--color <value> Whether to color output messages: auto, true, false
-d, --debug-info Generate debug info
-e, --emit <value> Output type: asm, c-header, llvm, tokens, tree
--no-bounds-check Disable array index bounds checking
-O <value> Optimization level: 0, 1, 2
-o, --output <file> Specify name of output file
-t, --text Output assembly as text
The --color option specifies whether output messages
(e.g. errors and warnings) should be colored:
-
auto- Color if printing to a terminal but not otherwise (the default) -
true- Color output messages -
false- Do not color output messages
The --emit option specifies the type of file to emit:
-
asm- Assembly file (the default) -
c-header- C/C++ header file -
llvm- LLVM IR -
tokens- List of tokens -
tree- Abstract Syntax Tree (AST) in JSON format
The -O option is used to specify one of the following optimization levels:
-
0- No optimization (the default) -
1- Basic optimization -
2- Aggressive optimization
Compile test.wip to an object file:
wip test.wip
Compile test.wip to an object file with optimization enabled:
wip test.wip -O 2
Compile test.wip to an object file with debug info:
wip test.wip -d
Output a C/C++ header for test.wip:
wip test.wip --emit c-header
Output LLVM IR as text for test.wip:
wip test.wip --emit llvm -t