JAL manual - compiler

previous up next


basics

The jal compiler is a command-line tool. The same compiler is available for the DOS command line (DPMI interface required), the windows command line (windows has a build-in DPMI interface), and for linux-386.

The minimum hardware required to run jal is a 386 (no 387 required) with 4Mb real memory and 10Mb virtual memory. For large programs more memory (both real and virtual) might be needed.

The jal compiler does not use compiled libraries: the total source of an application is compiled at once. This avoids some complexity in the compiler and allows global analysis and optimizations, but it makes the compilation process slower.

After a successfull compilation the jal compiler produces two output files. The base name (file name without extension) of these two files is the base name of the last file on the command line. The first output file has the extension .hex and contains the hex dump of the compiled program. This file can be used directly with most programmers. The second file has the extension .asm and contains the assembler (text) of the compiled program. This file can be used to inspect the generated code and to make small modifications. The assembler file can be assembled with the standard Michrochip assembler.

The compiler has a wealth of options to enable various debugging output.


command line

The jal command line can contains source files and options. An option starts with a '-', everything else is a source file. The catenation of all source files is compiled to a .hex and a .asm file.


options

-t or -tN : test

The -t option enables testing of the compiled program by the build-in simulator. Optionally the maximum number of instructions can be specified (default 10_000_000). By default no testing is done.

-386 : run on 386-class machines

The -386 option should be used when running on 386-class machines to get a reasonable compilation speed. It is equivalent to -vz -cX.

For the next options the lowercase letter enables and the corresponding uppercase letter disables. x enables (and X disables) all categories.

-c$ : checks

The -c option switches checks on and off. The default is -cxBP: enable all checks except the memory pool and memory blocks. $ can be a sequence of:

   b : check the memory Blocks (modestly CPU intensive)
   p : check the memory Pool (awfully CPU intensive)
   a : check the internal Assertions
   s : check the Stack use
   z : Zero all memory before use

-o$ : optimizations

The -o option switches optimizations on and off. The default is -ox: enable all optimizations. $ can be a sequence of:

   f : constant expression Folding
   r : strength Reduction
   s : tree Shape (expression reordening)
   c : tail Call chaining
   t : Trivial expression folding
   d : Dead code removal

-s$ : search

The -s option adds $ to the list of directories to be searched for include files. The directories are searched in reverse order: the directory mentioned by the first -s option is searched last. The current directory is always searched first.

It is advised to put the library files which are provided in the JAL distribution in a lib subdirectory and always put a -slib option on the jal command line.

-v$ : verbosity

The -v option switches logging on and off. This is mainly usefull for debugging the compiler. The default is -vz: only progress loggings. Enabling any other logging disables the progress logging. $ can be a sequence of:

   s : logging in the Scanner
   p : logging in the Parser
   o : logging in the Optimizer
   q : logging in the sQuasher
   r : logging in the Register allocation
   c : logging in the Code generator
   a : logging in the Assembler
   t : logging in the Test (simulator)
   z : show the progress of the various passes

examples

compile a single source file:

   jal file

serach the \jal\lib subdirectory, compile for a 16c84_4, use the jlib library, no optimizations, all checks but the memory pool, logging in the optimizer:

   jal -s\jal\lib 16c84_4 jlib file -oX -cxP -vo 


previous up next