Bcpl
BCPL is a simple typeless language that was designed in 1966 by Martin Richards
Install / Use
/learn @8l/BcplREADME
BCPL CINTCODE DISTRIBUTION (Revised 28 June 2013)
The following change was made on 31 May 2013.
The BCPL compiler has just been upgraded with options t32 and t64 to allow it to generate 64-bit Cintcode when running on a 32-bit system, and 32-bit Cintcode when running on a 64-bit system. The 32-bit Cintcode compiled code is placed in cintcode/cin, and the 64-bit code is placed in cintcode/cin64. The old BCPL64 distribution is now obsolete.
In directory BCPL/cintcode the command
make clean make
will rebuild the 32-bit Cintcode system called cintsys, and
make clean64 make sys64
will rebuild the 64-bit Cintcode system called cintsys64.
The command-commands b64, bc64, bs64, bcb64, bsb64, bcl64 and bsl64 will compile to 64-bit Cintode when the compiler is running on either a 32- or 64-bit system.
The command-commands b, bc, bs, bcb, bsb, bcl and bsl will compile to 32-bit Cintode when the compiler is running on either a 32- or 64-bit system.
The directory BCPL/cintcode/cin holds 32-bit Cintcode compiled code. The directory BCPL/cintcode/cin64 holds 64-bit Cintcode compiled code.
c compall will recompile all the BCPL code for the 32-bit version c compall64 will recompile all the BCPL code for the 64-bit version
******************** IMPORTANT *****************************
On 12 Oct 2006, the location of cintsys and rastsys moved from $BCPLROOT to BCPLROOT/bin. This will require a change in the setting of the PATH environment variable.
Before installing BCPL, read this README file and remember to edit the Makefile and set the environment variable BCPLROOT to your chosen absolute location for the cintcode directory, and include this in the PATH environment variable.
On my system (using bash under Linux), this is done by:
export BCPLROOT=/home/mr10/distribution/BCPL/cintcode export PATH=$PATH:$BCPLROOT/bin
(The variables BCPLPATH and BCPLHDRS now do not need to be set if their values would be $BCPLROOT/cin and $BCPLROOT/g, respectively)
After installing BCPL, you may have to re-install packages that depend on it, such as Cintpos, Cobench, Tcobench, Bench, MCPL, VSPL, etc.
A manual for Cintcode BCPL and Cintpos is available via my home page.
Latest changes: ---------------------------------------------------
04/10/07 Several files changed to make it easier to compile the system under Windows using the Microsoft Visual Studio tools. See the instructions below.
10/11/06 Added the -slow option to force using the slow interpreter (interpret) all the time. This is useful if there seems to be a bug in cinterp or fasterp. Updated the programs com/dumpsys.b and com/dumpdebug.b to help analyse analyse compacted dumps of the Cintcode memory (typically in DUMP.mem). Made a change to sysasm/cintasm.S to correct a bug relating to the Cintcode pc going negative.
08/11/06 Added the -d option to set the dump flag in the rootnode (equivalent to calling the command: dumpmem on). This will cause the entire Cintcode memory to be dumped to DUMP.mem in a compacted form if the Cintcode system returns with a non zero return code. The file DUMP.mem can be printed in a readable form using the dumpsys command (always assuming you have a working BCPL system).
07/11/06 Added the -f, -v and -V options to help people track down installation problems. They trace the behaviour of the system, particularly during the bootstrapping process.
The option -v generates a simple trace of the bootstrapping process, mainly within sysc/cintsys.c and sysb/boot.b. It should produce output similar to the following:
solestreet$ cintsys -v Boot tracing level is set to 1 Cintcode memory (upb=4000000) allocated Boot's stack allocated at 211 Boot's global vector allocated at 727 Rootnode allocated at 100 syscin/boot loaded successfully syscin/blib loaded successfully syscin/syslib loaded successfully syscin/dlib loaded successfully cintsys calling the interpreter CLI stack allocated at 8249 CLI global vector allocated at 8665
BCPL Cintcode System (7 Nov 2006) boot about to call the interpreter recursively It should start executing the boot function: startcli boot: about to call sys(Sys_interpret,...) startcli: can now use normal stream i/o startcli: trying to load syscin/cli startcli: loaded syscin/cli successfully startcli: now entering the cli cli: now entering the main CLI loop 0>
The option -V is similar to -v, but also includes some Cintcode instruction level tracing.
The -f option traces the use of environment variables such as BCPLPATH within the function pathinput (defined in sysc/cintsys.c). It helps to solve problems caused by incorrect setting of the environment variables. Try calling:
cintsys -f
then
bcpl com/bcpl.b to junk
It should show the location of successfully opened files.
27/07/06 The treatment of GET directives has changed. Firstly .h is appended to the filename does not end with .h or .b. The name is then looked up in
(1) the current working diectory, then (2) the directories specified by the headers environment variable (typically BCPLPATH or POSPATH), and finally (3) the g/ directory in the system root, typically given by BCPLROOT or POSROOT.
25/07/06 Made loadseg first search the current working directory, then the BCPLPATH directories, and finally the cin/ directory in the BCPLROOT directory. Great news: you normally no longer have to define the BCPLPATH environment variable.
21/06/06 Modified the Makefile to allow the system to be cross-compiled for the GP2X handheld Linux gaming machine when running under Cygwin. Renamed most files to use lower case letters to ease some problems with windows machines.
16/05/06 For the native code version of BCPL, rdch from standard input reads the shell argument characters before reading from stdin. This required a change to natbcpl/sysc/clib.c and natbcpl/sysb/blib.b.
13/09/05 Made MakefileWin32 work under Windows XP using Visual C++ tools. The resulting executable was: cintsys.exe and it can be entered (for the first time) by the shell command: setupwin32 You may need to slightly edit setupwin32.bat.
30/08/05 ############### IMPORTANT CHANGE ######################### Change name of the BCPL Cintcode executable from cinterp to cintsys to make it documentation more compatible with cintpos. The raster version rasterp was also changed (to rastsys).
26/07/05 A version for the Mac PC running Mac OS X has just been added, although it does not currently use the hand written assembly language interpreter yet.
End of recent changes ----------------------------------------------
This is the README file for the NEW VERSION of the BCPL distribution. Note the slight change in directory structure and the use of the environment variables BCPLROOT, BCPLPATH and BCPLHDRS. For details see below.
This distribution of BCPL is free of charge to individuals for private use and to academic institutions, but please, if you install the system, send me an e-mail message (to mr@cl.cam.ac.uk) so I can keep a record of who is interested in it. It is available via my Home Page (http://www.cl.cam.ac.uk/users/mr).
It provides a machine independent interpretive version of BCPL. The interpreter in implemented in C, but for some architectures it also has a version implemented in assembly language giving improved performance.
This distribution contains versions of the system for Linux, DEC Alpha machines, Mips R2000/3000 and Mac Power PCs, Sun4s, Sun/SPARCs and 386/486/Pentium machines under MSDOS, Windows 95/98/NT/2000/XP, Windows CE2.0 (for the HP 620LX), Mac OS X or OS/2. Some implementations have not been tested recently and are rather out of date. The simplest installation is for Linux machines. Installation on other machines is described later. This distribution does include the executable: cintsys.exe that should run under most Windows systems on Pentium mased machines.
TIME/ADDRESS DIAGRAMS
A version of the interpreter that can generate a time/address diagrams in Postscript has been added to the distribution (see com/raster.b, com/rast2ps.b, sys/rasterp.c and sys/rastlib.c)
PROFILING
Profiling and statistics gathering is available, see com/stats.b
CHANGE LOG
For a log of recent changes look in cintcode/doc/changes.
NATIVE CODE
A BCPL system that generates native is now available in this distribution. It currently only provides code generators for the i386 and DEC Alpha architectures. On these machines it gives a speed up of about a factor of ten.
PERFORMANCE STATISTICS (Cintcode interpreters)
BCPL self bench Date
compilation measured
Cintcode instructions 22244904 6176753 12 Jan 96 executed
2.4GHz Athlon AMD64 Windows XP 0.609 0.140 15 Sep 05
1GHz Mobile Pentium III 0.460 0.130 15 Sep 05
1GHz Mobile Pentium III native 0.150 15 Sep 05
66MHz 486 Linux 5.340 1.360 11 Jan 96
120MHz Pentium Linux 2.030 0.550 12 Jan 96
90MHz Pentium Linux 2.770 0.710 31 May 96
90MHz Pentium Linux native 0.75 0.109 19 Aug 96
450MHz Pentium Linux 0.760 0.270 7 Jan 00
450MHz Pentium Linux native 0.09 0.03 7 Jan 00
400MHz Pentium Windows NT 0.881 0.320 7 Dec 99
150MHz DEC Alpha 3.199 0.766 12 Jan 96
DEC R2000/R3000 Mips (10MHz?) 45.750 12.394 12 Jan 96
Sun4m ???? 13.549 3.817 12 Jan 96
Sun4m SPARC 20 Model 514 9.830 2.610 12 Jan 96
75MHz SH3 Windows CE 2.0 7.558 3.517 7 Jan 00
Notes:
- The times are real times (including I/O) and they are in seconds.
