Using the ICL 1900 BCPL Compiler
The input to the compiler consists of a program description (or steering segment). The program description can indicate where the BCPL program is to be read from, or can be terminated by a "*" and followed by a sequence of BCPL segments terminated by "." or the end of the file.
If the compiler is entered at entrypoint 0 (address 20) then the program description will be read from *TR0, entrypoint 1 will read from *CR0 and entrypoint 5 will read from a *ED file whose name is given in the initial X registers in the form of a BCPL string.
Files read from *TR or *ED may be in normal format (3-shift, upper and lower case), files read from *CR will be in graphic format (6 bit, upper case only).
The BCPLGO macro will provide a default program description unless the OWNPD option is given on the call. It will arrange for the program to be read on *TR0 so the user program can include lowercase.
The BCPLGO macro
BCPLGO -
OWNPD, -
COMPTIME max-compilation-time, -
PROG source-file, -
SAVESEMI semicompiled-output, -
NOCONS, -
SEMI semicompiled-input, -
LIB library, -
BASICLIB subgroupsrb1, -
SAVEBIN compiled-output, -
LIST listing-output
OWNPD
If the OWNPD option is present then the program description is read from the source file, otherwise it is read from :LIB.STANDARDPD.
COMPTIME
The COMPTIME option can be used to give more time to the compilation. If it is not used the compilation will be limited to 5 minutes.
PROG
Specifies the source file.
SAVESEMI
A file to save the semicompiled output.
NOCONS
Don't run the consolidator after the compilation.
SEMI
Include a file of semicompiled segments. Note that the SEMI parameter must have a matching INC in the BCPL program description.
LIB
Search a library. Note that the BCPL program description must have a matching LIB line.
BASICLIB
Specify an alternative to the standard BCPL library, :LIB.SUBGROUPSRB1.
SAVEBIN
Specify where to save the compiled program.
LIST
Specify where to save the compiler listing. By default it is listed on *LP.
Program description statements
All of these steering lines, and any other lines found in the program descripton are also passed to the code generator, CGMX.
FULLIST, LIST, SHORTLIST, NOLIST
Specifies the level of output wanted. The listing level can be followed by the specification of the output medium in parenthesis, for example:
LIST(20)
to output to *LP0.
BCPL
Defines where the BCPL program is to be read from, either a numeric medium code or a *ED file name, for example, to read from *CR1:
BCPL(31)
OCODE
Defines where the OCODE is to be written to, either a numeric medium code or a *ED file name, for example, to write to the workfile !1:
OCODE(!1)
This option can also be written as OUT(...).
ASCII
Sets compiler option 39, which causes the characters "£" and "$" to be swapped, useful if the source file is in standard ASCII rather than the ICL ECMA character set. (Note that the compiler treats "£" as if it were a backslash).
VDU or £=$
Sets the "pound equals dollar" flag, which causes "£" symbols read by the compiler to be treated as "$" symbols. This is done in the NEXTSYBM routine, whereas option 39 (see above) is done earlier, in READLINE.
$=£
Sets the "dollar equals pound" flag, see above.
LEVEL1
Sets compiler option 28, which disables the BY, IFNOT ("else"), IFSO ("then") and LOOP keywords.
LEVEL3
Sets compiler option 30, which enables the (unimplemented) EXTERNAL, REP and SELECTON keywords. LEVEL1 overrides the LEVEL3 option.
NIL
Sets compiler option 31, which enables the NIL keyword as a synonym for "?" . LEVEL1 overrides the NIL option.
OUT=ENDCASE
Sets compler option 29, which enables the OUT keyword, a synonym for ENDCASE. Note that this option is overridden by LEVEL1.
STAR
Specifies whether expr*(expr) or expr*[expr] should be interpreted as multiplication (the default) or vector application (for old-style BCPL code).
CHAIN
Specifies the program to be run after the compiler, normally CGMX.
TREESIZE
Specifies the size of the compiler workspace in words.
ALPHACODE
Tells the compiler to use mnemonic instructions for the OCODE output. GCMX
can read this format as well as the normal numeric format, it may useful for debugging
the compiler or CGMX.
DEBUG
Sets compiler option 1, which causes the compiler to just read the souce one symbol at time, printing them as read. For debuging the lexical analysis stage.
TREE
Sets the TREEDEPTH value for the compilation.
NOCODE
Sets option 3, which does nothing in the compiler.
GLOBALS
Sets option 4, which reports on global usage.
MONITOR
Sets option 6, which does nothing in the compiler.
NAMES
Sets option 7, which outputs some name information.
TRANSTRACE
Sets option 8 which outputs the stack base address when compiling, used for
debugging memory usage?
NAMETREE
Sets option 9, which outputs the "nametree".
PPTRACE
Sets the PPTRACE flag which cases all input read by NEXTSYMB to be output.
TIMEA
Sets option 11, which causes the compiler just to read the source one character at a time, for timing checks?
TIMEB
Sets option 12, which causes the compiler just to read the source one symbol at a time, for timing checks?
Options in the source code
As well as the various options included in the program description it is possible to include options in the source code by writing them as %char.
Everyhing on the line after the %char will be ignored.
%S, %N, %L, %F
Has the same effect as SHORTLIST, NOLIST,LIST, or FULLLIST.
%P
Writes a pagethrow to the listing.
%A, %Z
Enables or cancels ASCII mode.
%D, %U
Sets or clears the "pound equals dollar" flag.
%M, %V, %Q, %R
Set or clear options 36 and 37 which control the interpretation of expr*(expr) and expr*[expr] as either multiplication or vector application.
%M -- both are multiplication.
%V -- both are vector application.
%Q -- expr*[expr] is vector application.
%R -- expr*(expr) is vector application.
%#text
The text is passed to the code generator, for example:
%#SEGMENT(%BONG)
Options handled by the code generator
The program description is passed from the compiler to the code generator along with the OCODE translation of the program. The code generator recognises these program description commands, which can also be specified in the BCPL source using the %#text form:
ALTER
Allows modification of values in the code generator:
ALTER address, value
APPEND
APPEND(filename)
Append the SEMICOMPILED output to an existing file.
BASICLIB
BASICLIB(library)
Specifies the name of the basic BCPL library, SUBGROUPSRB1 by default.
BIN
Either just BIN to run #XPCK after CGMX, or
BIN(outputfile)
to name the compiled output file.
DEBUG
Generate code with tracing and debugging information.
DUMP ON
DUMP ON(filename)
Name of compiled output file
INCLUDE
INCLUDE(symbol)
Instruct #XPCK to include symbol in compiled program, searching libraries to find the symbol.
INC
INC(file)
Instruct #XPCK to include semicompiled segments from a file.
LIB
LIB(library)
Instruct #XPCK to search a library.
MASTER
MASTER(segment-name)
Set the segment name and mark it as the master segment.
NOT
Can be used before another steering line to turn it off, for example:
NOT BIN
will turn option 7 off, so #XPCK will not be run at the end of
the compilation.
OCODE
Specifies OCODE input file
OMIT
OMIT(symbol, symbol,...)
Tells #XPCK not to search libraries for one or more symbols.
OVERLAY
OVERLAY(number/number, seg, ...)
Defines overlay layout for #XPCK
PRIORITY
Sets the program priority
PROGRAM
Sets the program name.
READFROM
See OCODE
RUN
Instructs #XPCK to run the compiled program on completion.
S/C
Name of semicompiled output file.
SEND TO
See S/C.
SEGMENT
Sets segment name.
SEMICOMP
See INC.
SPACE
SPACE(number)
Uses the %BFIXEDSAVE segment to implement call and return with a
fixed stack size.
SWITCHES
SWITCHES(number, number, ...)
Turns on (or off when used with NOT) code generator options.
TRACE
Generate code with information necessary for tracing and debugging.
Default program description
By default BCPLGO gives the compiler the following program description on *CR0:
BCPL(00) // read BCPL from *TR0
OCODE(!1) // Send OCODE to workfile !1
SEND TO(!) // Send semicompiled to workfile !
BIN // Tell CGMX to run #XPCK
CHAIN(FIND#CGMX) // Run OCODE to semicompiled
LIST // Produce compiler listing
TRACE // Include tracing information
INCLUDE(SEG1001,%BSTART,%BTRACE,%BDEBUG,%BEDSFILES)
// Library segments to include