Updated August 2018; see History
COMPIL srcfile {switches}
COMPIL and its aliases COMPLP and OCMPIL each process an ASB source file, creating a compiled RUN file which can be executed by RUN.LIT. The line above shows the syntax for all three variations. For example:
COMPIL MYPROG.BAS /X:2/LF/M/C:APP_VER=9
Parameters and Switches
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 the list of switches for A-Shell is quite a bit larger than applied to the original COMPIL.
Switch |
Function |
---|---|
/13 |
OCMPIL mode (BASIC 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. |
/F1 |
Disables the header signature which otherwise would be used if the program contains any features introduced in 6.5. |
/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. |
/NOTRC |
Ignore all trace related statements during compilation (++pragma TRACE_xxx, TRACE.xxx, DEBUG.xxx). |
/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. |
/P |
Enables support for Named Parameters. |
/PX |
Superset of /P, which is implied; enables automatic removal of un-referenced functions and procedures from the compiled output. The removed routines are also marked as such in the /LF List File. |
/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 BASICplus syntax elements. These are clarified in more detail in the section on BASICplus extensions. |
/X:2 |
Enables the use of certain A-Shell extensions to BASIC. See A-Shell Extensions. |
/X:3 |
Same as X:2, but creates an SBX file instead of RUN. |
/? |
Writes switch listing to the screen. |
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 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, which is equivalent to COMPIL with /13 switch, is designed to emulate the AlphaBASIC 1.3 compiler of the same name. |
• | COMPIL emulates the AlphaBASIC 1.4 compiler. |
• | COMPLP is equivalent to COMPIL/X:1 and is designed to emulate the 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 in EXLIB:[908,73], 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, and Compiler Edit History for information on changes to the compiler.
History
2019 March, A-Shell 6.5.1657, COMPIL.LIT 1.1(136): add /F1 switch.
2018 August, A-Shell 6.5.1639, COMPIL.LIT 1.1(135): add /NOTRC switch.
2017 July, A-Shell 6.5.1610, COMPIL.LIT 1.1(134): makes the scroll bar visible if the environment supports it (A-Shell/Windows and ATE version 6.5.1610 or later) and the output of the command causes the screen to scroll.
2016 May, COMPIL.LIT(132): /PX extends pre-pass to eliminated unused functions
2016 October, COMPIL.LIT(133): Add support for /IGOO
2015 September, COMPIL.LIT(131): /XTAGS generates CTAGS output
2015 August, COMPIL.LIT (130): /CTAGS generates a list of includes