COMPIL

Updated October 2015; see History

COMPIL and its aliases COMPLP and OCMPIL each process an AlphaBasic or A-Shell/Basic source file, creating a compiled RUN file which can be executed by RUN.LIT. Using COMPIL as an example, the syntax for all three commands is:

COMPIL srcfile {switches}

For example:

COMPIL MYPROG.BAS /X:2/LF/M/C:APP_VER=9

See Compiler Edit History for information on changes to the compiler.

Parameters

srcfile

specifies the program source file (with an assumed extension of .BAS or .BP). If omitted, COMPIL will display the internal compiler version number.

switches

provide options and expanded capabilities. Note that there several switches supported by A-Shell which are not supported by AMOS (AV, C, D, DEBUG, LF, MX, RC, V:1, VC, X:2, and X:3).

Switch

Function

?

Display list of switches.

13

OCMPIL mode (AlphaBASIC 1.3 compatibility)

A

Increase size of offsets used for program addresses from 16 to 24 bits. This fixes "transfer address out of range" compiler errors. Beginning with COMPIL version 1.0(112), /A is invoked automatically (as needed).

AV

Additional Variables: Extends the allowable number of variables.

B

Background: Send errors messages to <sourcefile>.lst.

C

(C:symbol=value) Provides for passing Compiler Symbol Definitions.

CI

Enables case insensitive compilation. Note that this applies to labels and function/procedure names as well as variables and symbols.

CTAGS

Outputs just a list of ++include files to <source>.LST. Mainly for internal use by APN.

D

Enables use of certain d/BASIC statements.

DEBUG

Activate conditional debug code by compiling the variable DEBUG as 1.

I

Allow the use of ISAM 1.0 statements (not relevant for OCMPIL or /13)

IGOO

Treats all ++includes as ++include'once; "IGOO" = Include Global Once Only.

IEEE

Assume F,8 instead of F,6 if variable size is not specified.

LF

Creates a consolidated List File showing all of the source with location offsets.

LI

Local Include causes the directory information on any ++INCLUDE statement to be ignored.

LSM

Create .LSM file containing metadata used by APN.

M

Mapped variable required: causes compiler error for any unmapped variables.

MX

Unmapped Variable List: Reports every line in which an unmapped variable appears.

N

Turns off the display of compiler statistics.

O

Removes the internal line number references from the compiled object code, making it smaller and faster, but eliminating the capability for error handling routines to display the line number of the error.

RC

Run Compatible: Preserves runtime compatibility for AMOS.

S

Silent: Turns off the display of ++include file names.

T

Trace: Display source code as it is being processed.

V:1

Attempts to duplicate AMOS 1.4 and higher.

VC

(VC:pattern) Version Copy causes the compiler to make a backup copy of every source module encountered according to the specified pattern.

XTAGS

Outputs a "tag" file to <source>.TAGS. Mainly for internal use by APN.

X:1

Enables use of certain BASIC Plus syntax elements. These are clarified in more detail in the section on BASIC Plus extensions.

X:2

Enables the use of certain A-Shell extensions to AlphaBASIC. See A-Shell Extensions.

X:3

Same as X:2, but creates an SBX file instead of RUN.

Definition File: compil.def

 

Comments

The three LIT commands are just wrappers which process parameters and then call the internal compiler module embedded inside the A-Shell executable (via XCALL MIAMEX, MX_COMPIL). In fact, they are all the same, but they act slightly differently (mostly in terms of default switches) based on looking at their own name at runtime.

  OCMPIL (equivalent to COMPIL with /13 switch) is designed to emulate the AMOS AlphaBasic 1.3 compiler of the same name.

  COMPIL emulates the AMOS AlphaBasic 1.4 compiler.

  COMPLP is equivalent to COMPIL/X:1 and is designed to emulate the AMOS BasicPLUS compiler of the same name.

Note that the OCMPIL nearly always produces the exact same output (RUN file) as the AMOS equivalent, and thus is the best choice when cross-platform compatibility is important. On the other hand, it lacks several features, such as support for ISAM-A, structure loops, SWITCH, user-defined functions and procedures, etc., and thus is the worst choice when developing for the A-Shell platform exclusively.

In addition to the three LIT wrappers, there are two standalone (native executable) implementations of the compiler, which do not depend in any way on the presence of A-Shell:

compil.exe  (Windows)

compil      (UNIX)

For the standalone implementations, the switches are the same, but the syntax is slightly different. The switches must precede srcfile, use the lead-in character "-" (rather than "/"), and are case sensitive (must be lower case). For example:

c:\compil.exe -a -b -m -x:2 prog.bas)

There is also another front-end, RECOMX.LIT, distributed in the SOSLIB, which compiles all of the BAS and BP source files in the current account. The source code of RECOMX is provided so that the switch settings can be customized for individual developers.

See A-Shell Extensions for additional details of the compiler and related language features.

History

2015 October, A-Shell 6.1.1420:  Add CTAGS and XTAGS switches.