Vn 3.07 8-Aug-2021

BCPL under Windows

This document provides a guide to installing the environment necessary to compile and run Robert Nordier's 'Classic BCPL' compiler distribution kit under Windows (XP/W7/W10).  This Windows port of  Martin Richards'  BCPL compiler dating from the early 1970s produces executable programs (.exe files) which will run in native mode under Windows, without need for an intermediate VirtualBox unix system or Windows Cygwin installation.

This kit includes four much more recent, extended, versions of the BCPL compiler (dated 16-June-2004, [in directory BCPL 2006-06-16], 13-Aug-2014 [BCPL 2014-08-13], 17-May-2013 [X-BCPL 2013-05-17]) and 13-May-2020 [BCPL 2020-05-13]

A further early version of the compiler, oBCPL, chronologically a little later than the 'Classic BCPL' compiler, and which produces OCODE as its output rather than INTCODE (and hence has a rather different assembler generator again written by Robert Nordier), is available as a separate kit and is documented as 'Ocode BCPL Under Windows'.

Disclaimer

This is a 'work in progress'.  While it appears to function correctly, bugs may appear which will hopefully be fixed, and things which presently work may be changed to improve them - See 'Bug Fixes & Changes'

While nothing has been engineered into this kit which is intended to harm your PC or its files I have to state that this is free software.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Dave Cannon
D.Cannon(at)ex.ac.uk



0.    Contents

  1. Tools Required
  2. Why do I Need All This Stuff?
  3. One Step at a Time
    1. The BCPL KIt
    2. The GNU Compiler, Assembler and Loader
      1. GNU Loader Script Files
    3. The GNU 'make' utility
    4. The GNU CoreUtils Package
    5. The GNU util-linux-ng Package - 'getopt'
  4. Compile the Compiler!
  5. And now to BCPL...
  6. Write Your First BCPL Program
  7. Compile and Run it
    1. Other BCPL Programs
    2. Writing Your Own Code - Command-line Input
    3. The BCPL.cmd Script
  8. Notes on the Compiler
  9. Bug Fixes & Changes
  10. Known Bugs
  11. The Current BCPL Compiler...
  12. Acknowledgements

1.    Tools Required


2.    Why do I Need All This Stuff?

Firstly, you're going to compile the BCPL compiler - which is written in BCPL - so you'll need some tools to do that.

Secondly, no compiler runs without a way of talking to the user's screen or to files on disk, or without input from, say, the user's keyboard.  Equally, the programs created by the compiler need to do the same, otherwise their function is pretty limited.  Access to all these i/o facilities is granted, provided and policed by the operating system, in our case Windows.  This Windows port of Classic BCPL uses the c run-time library as an intermediary between BCPL's i/o requirements and the Windows application program interface (API) to those services - mostly because the c library API is much simpler than the Windows API - so we need to install c and some ancillary programs.  This is a Good Thing:  in addition to a functioning BCPL compiler you will also have available to you a c compiler, an assembler, a link loader, a swathe of Unix shell tools and the Code::Blocks integrated development environment!


3.    One Step at a Time

3.1    The BCPL Kit

First, download the Windows Classic BCPLkit.zip to a suitable folder on your PC, BCPL perhaps, and expand/unzip it.  This should create a folder called 'BCPLkit' containing a number of subfolders and files.  This is the set of BCPL compilers for Windows.

3.2    The GNU Compiler, Assembler and Loader

Next, download and install the GNU c compiler, assembler and loader packages.  I'm advised that identifying and installing a compatible set of these programs is non-trivial, however, there's an easy way to achieve this by downloading and installing the Code::Blocks IDE (Integrated Development Environment), which is itself built over the GNU development software.  A copy of the Code::Blocks installer, codeblocks-12.11mingw-setup.exe, known to work with this BCPL kit, is here

Note that the current Code::Blocks installer is a 64-bit build - it will install on a 32-bit version of Windows but neither it nor its sub-packages (including MinGW) will run on 32-bit Windows.  On 64-bit Windows Code::Blocks and its packages will run - unfortunately the MinGW package is a 64-bit build, and the loader ('ld') in particular cannot be persuaded to accept either 32-bit object files or to produce 32-bit executables.  The BCPL kit is a 32-bit build, therefore the earlier codeblocks-12.11mingw-setup.exe is the best and easiest option.

There's a useful video guide, "How to install GCC compiler in Windows XP/Vista/7" on YouTube to follow here.

If you already have a c compiler, assembler and loader package installed from some other source please BE AWARE that integrating the BCPL kit with your installation will be non-trivial, and you will in all likelihood need to edit ALL the scripts and Makefiles in order that the BCPL build will work.

Over the years I've found two things useful:

  1. Create a folder for your installation downloads, keep and run them from there
  2. Don't second-guess the preferred installation targets of your installers.  Your preference might seem brilliant, but you'll need to remember what it was when the package gets updated, and everything that follows on from here will need to be adjusted to accept your preferred target...

Once you have the Code::Blocks IDE installed, following the guide above, it's essential to check that the gcc compiler is now accessible from whereever you installed the BCPL source files (on my Windows 7 and Windows 10 systems this is "C:\Users\Dave\Apps\BCPL\BCPLkit\bcplkit-0.9.6\src").  To do this, open a 'Command Prompt' window (Windows Start button, click 'run' if on XP, type 'cmd' in the search box, then double-click 'cmd.exe' in the list if on W7).  In the Command Prompt dialog box that appears, type:

gcc --version
and you should see something like...
gcc (tdm-1) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you get:
'gcc' is not recognized as an internal or external command,
operable program or batch file.
then you need to check that you typed the path of the gcc compiler correctly into your computer's Environment Variables 'Path' setting.  If necessary, watch the video again.  A common error is to omit or confuse colons (:) and semi-colons (;).

3.2.1    GNU Loader Script Files


The GNU link-loader, ld, needs to be provided with a script file in order to search the correct locations for c library files during the link phases of building the compiler and any BCPL programs - by default it would search folders only present on a Unix system.  A choice of script files is provided in the distribution C:[...]\BCPL\BCPLkit\bcplkit-0.9.6\loader scripts directory.

As with 'Compiling the Compiler' (below) you should first choose which of:
i386pe_mg64.x    (for a 64-bit [Windows 7 or Windows 10] installation) or
i386pe_mg32.x      (for a 32-bit Windows installation)
best suits your system.  Copy your chosen script file to either C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\lib\ldscripts (on a 64-bit [Windows 7 or Windows 10] installation) or to C:\Program Files\CodeBlocks\MinGW\mingw32\lib\ldscripts (on a 32-bit Windows installation) and then rename this file to i386pe_mgw.x.  You will have identified the first part of these pathnames when modifying your Windows Environment Variables above.

If your installation varies from standard you will need to identify the differences and edit a loader script file to suit the pathnames on your system.

3.3    The GNU 'make' Utility

If you're familiar with reading Makefiles you might consider skipping this step, but the BCPL Makefile is lengthy.  You will probably want to make and re-make the BCPL compiler a number of times, and doing this by hand will become tedious - and errorprone.  'make' solves all these issues.

Download the 'make' 'Setup' Complete package, except sources, from the GNUWin32 server, and run it to install it.  Again, don't second-guess the installation target.  Once you've done this you must modify your Windows Environment Variables 'Path' setting as you did for the GNU compiler package, but this time for the location of the GNU 'make' executable.  On a Windows 7 or Windows 10 system this is normally:
C:\Program Files (x86)\GnuWin32\bin
while on a Windows XP system it is:
C:\Program Files\GnuWin32\bin
Close and reopen your Command Prompt window (to collect your modified path Environment Variable), and check your path, by typing:
make --version
and you should see, for example...
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32
Again, if you get:
'make' is not recognized... etc
then your path is wrong or missing.  It must work before you go further.

3.4    The GNU CoreUtils Package

Nearly there!  As before, if you're willing to read and interpret the BCPL compiler Makefile yourself, you could omit this step, but the same arguments apply as above.  It's easier this way!  Go to the GNU CoreUtils page and download the Setup program of the package into your downloads folder, and install it.  If you haven't overridden the preferred installation defaults this time there's no need to amend your Environment Variables 'Path' setting again - all the core utilities will cohabit the folder that 'make' is in, so if in your Command Prompt window you type:
ls --version
you will see...
ls (GNU coreutils) 5.3.0
Written by Richard Stallman and David MacKenzie.

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


3.5    The GNU util-linux-ng Package - 'getopt'

...one more thing:  the included BCPL.cmd scripts make use of a command-line argument parser called getopt.  Go to the GNU util-linux-ng for Windows page and download the "Complete package, except sources" Setup program into your downloads folder, and install it.  Again, this will go into your 'make' and 'core utilities' folder, so no further work is needed.  You can test the theory by typing:

getopt --version
and you should see...
getopt (enhanced) 1.1.4
If you're remotely familiar with Unix systems, you now have available to you a fully functioning subset of Unix shell commands - and, if you're interested, others are readily available on the GNUWin32 site - all you need to do is download and install them.


4.    Compile the Compiler!

We're there.  In your Command Prompt window, go to the location that your BCPL compiler kit files were unzipped to (this is "C:\Users\Dave\Apps\BCPL\BCPLkit\bcplkit-0.9.7" on my system, but only the bold part is likely to be replicated on your system).

So, type:

cd  C:[...]\BCPL\BCPLkit\bcplkit-0.9.7

In this folder you'll see a selection of folders and files, these being the parts of the BCPL compiler, and crucially two DOS command files to build the compilers themselves:

BCPLenv.cmd
Makeall.cmd

If you need to change the contents of either of these files - or anything else in this package - you'll need a competent editor.  My preference is the Notepad++ editor, which - if you're interested - you'll find if you search the web...

BCPLenv
is a simple command file to establish the environment necessary to build and run the BCPL compilers and programs in this package.  You MUST execute it from the directory you find it in - DO NOT move it anywhere else!  When you type...
BCPLenv
...you should see something like the following on a Windows 7 or Windows 10 system:
BCPL environment established as:
BCPLcopt=C:\Users\Dave\Apps\BCPL\BCPLkit\copt
BCPLdir=BCPLkit-0.9.7
BCPLenv=Vn 1.03 3-Jan-2016
BCPLhdrs=C:\Users\Dave\Apps\BCPL\BCPLkit\include
BCPLlib=C:\Users\Dave\Apps\BCPL\BCPLkit\BCPL 2006-06-16
BCPLocd=C:\Users\Dave\Apps\BCPL\BCPL-0.9.8
BCPLroot=C:\Users\Dave\Apps\BCPL\BCPLkit
BCPLsrc=C:\Users\Dave\Apps\BCPL\BCPLkit\bcplkit-0.9.7\src
MCPLhdrs=C:\Users\Dave\Apps\BCPL\BCPLkit\include
GnuWin=C:\Program Files (x86)\CodeBlocks\MinGW
minGWVn=4.7.1

Now you can build the BCPL compilers, and various BCPL programs which form this distribution package.

Type
makeall
and you should see the following output scroll up your Command Prompt window:

        ________ "copt" _________
gcc  -o copt copt.c

        ________ "BCPLkit-0.9.7\src" _________

# The BCPL compiler porting kit, dated 1980

as  -o su.o su.s
gcc  -c icint.c
gcc  -c blib.c
gcc  -o icint icint.o blib.o
cat iclib0.i blib.i syn.i trn.i >st0.int
cat iclib0.i blib.i cg.i >cg0.int
icint st0.int <xgV128.b
INTCODE SYSTEM ENTERED

...etc        (For the full listing, see MakeBCPL)

If you did, you now have a Classic BCPL compiler, running under Windows, together with four later versions of the BCPL compiler and a set of source and compiled BCPL programs!

 If you saw an error message, typically from 'make', you'll need to check at what point the build failed, and attempt to correct the problem.  It will probably be a broken path to one of the components.  If all else fails, feel free to contact me with as full a trace as possible of what happened - I'll try to help, if I can.


5.    And now to BCPL...

So, how to use the compiler?  If you take a look in your BCPLkit-0.9.7\src folder you'll see you now have a set of (32-bit) executable programs of various sizes:
Size

Name
63,507
cg.exe
59,923
cg0.exe
63,507
cg1.exe
36,213
icint.exe
101,907
st.exe
94,739
st0.exe
101,907
st1.exe
67,603
xg.exe
 52,755
xg0.exe
52,755
xg1.exe

A subset of these make up the BCPL compiler - st.exe is the syntax analyser and translator, producing OCODE, cg.exe is the code generator, producing INTCODE, and xg.exe is Robert Nordier's assembler generator, producing an assembler source file which is input to the GNU 'as' program to create Windows-compatible executables.  There's a DOS command file, bcpl.cmd, in the ...\src folder to make it easier to use these.


6.    Write Your First BCPL Program

This part's even easier, it's already been done for you.  The archetypal first BCPL program is 'hello.b', consisting of:
    get "libhdr"
    let start () be
        writes ("Hello, World*n")

7.    Compile and Run it

A copy of hello.b is in the 'C:[...]\BCPL\BCPLkit\bcplkit-0.9.7\util' directory, so, assuming your Command Prompt window is still in the '...\src' directory, type:
cd ..\util
and then type:
..\src\bcpl hello.b
(the '..\src\'... part is needed because the Windows script, 'bcpl.cmd' is not in the Windows 'path' Environment Variable - but you know how to fix that...)  This should output the following...
BCPL 1068376
OPTIONS  L12000

TREE SIZE 1948

PHASE 1 COMPLETE

PROGRAM LENGTH = 25

and if you then type:
hello
you should see:
Hello, World

7.1    Other BCPL Programs

The ...\util folder contains a number of more interesting programs written in BCPL, all of which should compile and run under Windows, including:
bgpm.b a later version of Christopher Strachey's GPM package (see below).  Some usage guidance is offered in the file: bgpm_readme.txt
cmpltest.b to run checks on the compiler output
gpm.b an implementation of Christopher Strachey's GPM macro language parser.  Some usage guidance is offered in the file: gpm_readme.txt
hanoi.b Amit Singh's solution of the Towers of Hanoi problem for five discs.
mlisp.b A C Norman's mini-lisp implementation (after compilation, try mlisp mlispdemo.l)
reftest.b a 'call-by-reference' test program
testb.b a test program which reads and lists items on its command line, and ends by calling MAPSTORE() to output the Global vector, the file table, and the BCPL stack
xgtest.b a test of the use of a globally defined GOTO statement
xref.b a BCPL source code cross-referencer (after compiling it, try xref < xref.b)

The included Makefile will compile all of the above - the usual caveats apply regarding your system and your installation.

If you're interested in macro processors, a BCPL implementation of Peter Brown's ML/1 is available as a separate download package: ML1.zip, and offers a thorough test of this compiler.  Extensive documentation on ML/1, its origins, implementations and test macros, are available on Bob Eager's official ML/1 site.

7.2    Writing Your Own Code - Command-line Input

BCPL was designed to be portable, so its reliance on the host Operating System services are minimal, being limited to twelve i/o requests and half a dozen system services (eg STOP() ).  These are all fairly straightforward to implement.  One facility which is undefined and therefore different on almost every BCPL port is how command-line arguments are passed through to the user's program.

The Windows BCPL port is built over the GNU c runtime API, and it seemed natural to pass c's concept of argv and argc through to the user's program - this is a fairly light touch approach where command-line arguments are separated by spaces, and each item on the argument list is passed by address to the BCPL START routine, with the number of arguments passed in argc.  The program 'testb.b' offers an example of its use:

LET start(argv, argc) BE
$(
...
FOR pct = 0 TO argc-1 DO
        WRITEF("argv!%n=%n (%s)*N", pct, argv!pct, argv!pct)
...
$)
When executed as:
testb this is a test
the program will output (amongst other things)...
Test command line args and dynamic vectors...
argv=2737088, argc=4

argv!0=2737096 (this)
argv!1=2737100 (is)
argv!2=2737104 (a)
argv!3=2737138 (test)
...

Note that every argument offered is passed through to the program as a (BCPL) text string - numbers are NOT converted to their value.  Equally spaces are the only recognised delimiter between arguments, so if you wish to perform your own argument parsing, you could use a non-space delimiter, for example comma (so: myprog arg1,arg2,longarg3) or you could enclose the whole set of arguments in quotes, eg myprog "arg1 arg2 longarg3".  In either case you will receive just one argument string.

Alternatively, blib.b, (the BCPL run-time library) offers a simple version of RDARGS() which will convert numeric arguments to their value and leave other arguments as BCPL strings - see blib.b for details.

7.3    The BCPL.cmd Script

As noted above, the most usual use for the BCPL.cmd script is 'bcpl myprog.b' to create 'myprog.exe', but typing...
bcpl
without arguments will list additional features - these are currently:
Usage:  ..\src\bcpl [-Options] [-o output] file
        where   file is a BCPL source program to be compiled
                [-o output] (optional) specifies the compiled program name
                [-Options] may be any of:
                [-O] (optional) invokes the copt code optimiser
                [-c] (optional) preserve OCODE output as 'file.ocd'
                [-i] (optional) preserve INTCODE output as 'file.i'
                [-l] (optional) preserve the 'file.o' output for ld
                [-S] (optional) preserve the 'file.asm' output

        ..\src\bcpl Vn 1.08     20-Aug-2014

If you're interested in the various intermediate stages of the creation of your executable, or you wish to optimise its code, there's an option to do it.

8.    Notes on the Compiler

This distribution package, BCPLkit.zip, is Robert Nordier's Classic BCPL kit, with a few extensions.  Classic BCPL accepted only uppercase characters, largely because the input devices of 1967/68 were Teletypes which handled only uppercase characters - though on the plus side they could read 5-track punched paper tape...   These days most keyboards default to lowercase so, to save finding that Caps Lock key, the BCPL compiler has been amended to accept BCPL reserved words, labels and variables in lowercase as well as the uppercase alternative - hence the 'hello.b' source program (above) is accepted by the compiler.

A slightly later (~1970?) development of BCPL allowed 'vectors' (arbitrary length word arrays) to be allocated and freed from 'heap' memory, using the v := GETVEC(n) and FREEVEC(v) calls.  These have also been implemented (using the underlying c library 'malloc' call) in this distribution, and a number of further additions have been made to allow the compiler to handle the current incarnation of the language (and hence compile the latest version of the compiler - see 9.    Bug Fixes & Changes for details).


If you prefer to experience Classic BCPL without these embellishments, go to the '..\src' directory, copy Makefile_Classic to Makefile then type:
make
to recompile the compiler using the original Classic BCPL source files.


9.    Bug Fixes & Changes

NB:  These changes/fixes are NOT included in the .._classic.x files (see 'Notes on the Compiler', above), except where noted.

8-Aug-2021
Bug fixed in translation of inline assembler (CODE) directive
2-May-2021:
The BCPL 2020-05-13 directory includes a version of the compiler, plus code and assembler generators, to support all the language extensions listed in Martin Richards' BCPL Manual:
  • Floating point
  • Externals
  • Assignment operators
  • Segment headings
  • Inline native assembler
(See the BCPLManual.htm in the ...\BCPL 2020-05-13\doc directory for details)

The bcpl.cmd file here has been extended to allow command-line options to be passed through to the compiler - see the bcpl.cmd script for details
5-Mar-2021: 'quiet' parameter added to suppress listing of run-time parameters
19-Feb-2021: Handling of inline assembler (Machine) code syntax improved to avoid compiler crashes
30-Oct-2020: Code added to list run-time parameters, if provided
30-July-2020: Fix to EXTERNAL declarations where STATICs but no routines are present
27-June-2020: GLOBAL numbers may also be negative, limited by NEGGSZ (in 'libhdr.h')
23-May-2020: Handling of inline assembler (Machine) code revisited and  amended
13-May-2020: EXTERNAL declarations supporting functions, routines and STATICs added
5-January-2016:
Edits to this file to clarify loader script installation
3-January-2016:
Bug fixes to the BCPLenv script to correctly identify the Code::Blocks home directory on most systems
30-October-2015:
Introduction of BCPLenv script, to establish the environment for the makefiles, compiler and programs
13-August-2015:
Replacement of Martin Richards' 30-April-2014 compiler with his 13-August-2014 version
19-June-2014:
Inclusion of Martin Richards' 30-April-2014 compiler
31-December-2013:
tm := time() support added to rtc.S (tm is the c tm struct) and timeofday(), date() added to blib.b
18-November-2013:
stream := findfile("filename", "mode") added to rtc.S and 'libhdr', where "mode" may take any of the modes in the forms permitted by the c  library 'fopen()' call.
11-November-2013:
Code and assembler generators for the xbcpl compiler (see below) revised to handle field selector operations (SELLD, SELST), as in:
          <constant expression>  ::=  SLCT <size>:<shift>:<offset> |  SLCT <size>:<shift> |  SLCT <size>
and thus
          F OF P := E, where the appropriate number of bits from the right hand end of expression E are assigned to the specified field F
26-October-2013:
A tidy-up release:
  • Common modules moved to the 'include' directory (see BCPLHDRS below)
  • Routine names passed through the INTCODE and assembler phases to aid debugging
  • ENDSTREAM(streamno), to close the nominated input or output stream, added to blib.b and LIBHDR files
24-October-2013:
Code and Assembler generators revised to correctly encode a%<non-trivial expression> := b
4-October-2013
Code added to blib.b to support a limited version of rdargs(), handling command-line parameters, and trap(), which catches attempts to call undefined GLOBALs
19-August-2013:
All Makefiles and BCPL.cmd scripts updated to use the gcc Vn 4.7.1 c compiler, assembler and loader.  (Was 4.4.1)
18-August-2013:
SYSERR (error output listing) is now pre-opened during BCPL initialisation and can be selected at runtime using the MANIFEST constant SYSERR, as listed in 'libhdr'
14-August-2013:
Incorporation of Robert Nordier's current xg.b assembler generator, 2012.  (Vn401, 2013/08/09 21:34:16, in this distribution)
11-March-2013: Correction to 'xg.b's encoding of the infix byte operator '%', when used in a non-trivial statement such as string%(index+count) := bytevalue.  This failed to collect the required bytevalue from the BCPL stack.
10-February-2013: Fix to PATHFINDINPUT() to accept <path> specified as 0 (zero)
GETENV(<environment name>) added to 'rtc.S', 'blib.b' and 'libhdr' to support PATHFINDINPUT()
9-February-2013: PATHFINDINPUT() support added to 'rtc.S', 'blib.b' and 'libhdr'.  Later versions of the compiler use this to resolve GET "<filename>" requests in BCPL programs.  PATHFINDINPUT(<filename>, <path>) searches in the following sequence:
  1. in the local directory - a matching <filename> here thus overrides any in the nominated library directory
  2. in the directory search tree specified by the environment variable '<path>', if any - this might be:
    "BCPLHDRS", where the environment variable BCPLHDRS=C:\Program Files\CodeBlocks\MinGW\include, for example
  3. a built-in library directory specifier, currently: \Users\Dave\Apps\BCPL\BCPLkit\include
1-February-2013:
Added RENAME() and DELETE() file support to 'rtc.S', 'blib.b' and 'libhdr'
MAPSTORE() now accepts an optional argument to list the nominated number of GLOBAL vector items - default is 100
30-January-2013: Added ENDTOINPUT() support to 'rtc.S', 'blib.b' and 'libhdr'
Added ABORT() support to 'rtc.S', 'blib.b' and 'libhdr'
29-January-2013: Added FINDAPPEND() support to 'rtc.S', 'iclib.i' and 'libhdr'
Split STACKTRACE() from MAPSTORE() in 'blib.b'
27-January-2013: fix to xg.b (and xg_i.b) to translate the BCPL 'SECTION' directive to an assembler '.title' directive.  The assembler '.section' directive causes code to be inaccessible...
7-January-2013: fix to unrdch() in rtc.S - NB: this fix also applies to the 'Classic BCPL' build
6-January-2013:
syn.b modified to support the '~' (NOT) operator
22-December-2012: Mods throughout to support the ABS operator
20-December-2012: Mods throughout to support the 'SECTION' directive
20-December-2012:
Mods throughout to support the infix byte operator '%', so 'x := getbyte(vec, 3)' becomes 'x := vec%3' and 'putbyte(vec, 10, 'z')' becomes 'vec%10 := 'z''
19-December-2012:
syn.b and trn.b modified to allow '?' to be used in initialisation of variables, TABLE data, etc.
9-December-2012: syn.b modified to allow '{' and '}' as alternatives to the section brackets '$(' and '$)'.  NB - '{' and '}' may not be tagged.
6-December-2012: Mapstore() implemented in blib.b
5-December-2012: Global limit increased from 100 to 350 in trn.b
5-December-2012: Cleared bug in call to GETVEC() which limited requested space to ~8000 words.  This bug in the argument passing mechanism may also have affected other calls supported by the GNU c runtime system.
2-December-2012: Fix to xg.b to handle the INTCODE phrase 'JIGxyz', where xyz is a global number, which occurs where a program includes 'GOTO fred' and fred is declared as a global.
28-November-2012:
Constant limit increased from 4000 to 7500 in cg.b
27-October-2012:
Name limit increased from 1200 to 2200 in trn.b
3-October-2012: Mods throughout to support GETVEC() and FREEVEC() memory requests
28-September-2012:
syn.b modified to accept BCPL reserved words, labels and variables in lowercase

10.    Known Bugs

...as of:
Issue
8-Aug-2021: none

11.    The Current BCPL Compiler...

BCPL has moved on from the early version presented here as 'Classic BCPL'.  Martin Richards' web pages detail its current incarnation, and four versions are also present in this package.

Following the successfull build of the 'extended' version of the Classic BCPL compiler, detailed above, Makeall should have gone on to build four later generations of the BCPL compiler, capable of creating Windows executable programs conforming to the then current specification of the language.  The  'BCPL 2006-06-16',  'BCPL 2014-08-13, 'X-BCPL 2013-05-17' and 'BCPL 2020-05-13' subdirectories should contain, respectively, the 16-June-2006, the 13-August-2014, 17-May-2013 and the 13-May-2020 versions of the BCPL and XBCPL compilers.  These in turn are capable of creating 32-bit Windows executables from BCPL source programs.

Many implementations of the BCPL compiler were built and ported to a range of machines and architectures.  Some still exist and can be found on the 'net.  They include:
The CTSS Compiler, 1968 The earliest known operational compiler
ICL 1900 Compiler, 1969
Data General Nova Compiler, 1978
An IBM 360/370 Compiler, 1979
DEC PDP-10 Compiler, 1979 Compiled direct to machine code
The Xerox Alto Compiler, 1980 Introduced the concept of the data 'structure'
ICL 2900 Compiler, 1986
Cambridge IBM 360/370 Compiler, 1981
The MIT Honeywell Multics BCPL Compiler, 1982 Produced a text version of OCODE as output
DEC PDP-11 RSX-11 Compiler, 1991

...and the Windows/Intel Compiler, 2020
available here

12.    Acknowledgements

Along with much of the 21st century world, I'm indebted to Martin Richards, for conceiving and creating BCPL, including his much updated and extended versions included here, and to Robert Nordier for his work in making available the Classic BCPL porting kit in a way that enthused me to try a Windows version.  The vast content of this port is due to their effort, and remains their copyright.


Dave Cannon
May 2021