BAP Online Manuals : Compiler Reference Manual : Description of the BAP Compiler Predicates
Previous: Compiler Quick Start - the 'Hello World' Example:
Next: Language Description:

3.4. Description of the BAP Compiler Predicates

This chapter will provide a closer look to the process of translation. It is presumed that you already successfully compiled the Hello World program.

As you have seen, you can easily start the compiler on your system by calling the ' load_compiler ' predicate. This is a predicate provided in the 'SYSMAN' system management library . The second predicate used, ' compile ()', is also provided there. It is used to compile files with the default options, which means that non-traceable optimized code is generated. This will result in the smallest and fastest code possible. As an alternative, the predicate ' compile (string,atom_list) ' is available. In addition to the name of the file to be translated, you may add a list of compiler flags to control the operation of the compiler. Currently three compiler flags are supported:

trace

enables generation of traceable code modules. Please consult the Host Server Manual for details on debugging. Traceable code is about 30-50% larger than regular code because it contains additional symbolic information needed for source level debugging . The trace option also reduces execution speed (about 30%).

no_opt

disables the prefix optimisation of the assembler. This will speed up the process of compilation, but results in larger and slower code. You may use this option to reduce compilation turnaround times.

no_code

disables the code generation at all. This will significantly speed up the process of compilation. You may use this option to reduce compilation turnaround times.

Please note that the two predicates ( load_compiler() and compile() ) are regular PROLOG predicates. They may be executed interactively using a ' SHELL ' or be used inside any BAP program. As an example, the module 'compiler' is provided in your 'example' directory. It will give you an idea of how to create a customized compilation front end. Also a 'make' utility is provided.

Also, the error server is provided in source code. The error server collects error messages from the scanner/parser and the code generator (the assembler should not have the need to complain about the input it gets from the code-generator) and presents them to you. Depending on your system it will either just write the error messages into a file or control an editor provided with the system. They are also displayed into the 'Error' Window, where you have to either hit <ESC> in order to stop, or <RETURN> to continue. Once you are more familiar with the BAP system, you may want to alter the error server to suit your special needs.


BAP Online Manuals : Compiler Reference Manual : Description of the BAP Compiler Predicates
Previous: Compiler Quick Start - the 'Hello World' Example:
Next: Language Description: