[net.micro.amiga] What's BCPL?

steve@wlbr.UUCP (Steve Childress) (01/20/86)

The term "BCPL" is used frequently in the Developer's manuals and here
on the net. Other than seeing the shifted pointers called BPTR's, I
would appreciate an explanation of what this is all about. Is this all
Sun-related?

Also- Someone commented about device drivers must "be BCPL code".
Can someone clarify? 

		Regards,
			Steve Childress
			{trwrb, scgvaxd, ihnp4, voder, vortex} !wlbr!steve
		        or	 		        ...wlbr!wlbreng1!steve

mykes@3comvax.UUCP (Mike Schwartz) (01/22/86)

BCPL stands for the "Before 'C' Programming Language", and was developed
for the PDP-11 many years ago by the folks who brought us UNIX (Ken Thompson,
et al).  I believe you can read more in The 'C' Programming Language.

david@ukma.UUCP (David Herron, NPR Lover) (01/24/86)

In article <376@3comvax.UUCP> mykes@3comvax.UUCP (Mike Schwartz) writes:
>
>BCPL stands for the "Before 'C' Programming Language", and was developed
>for the PDP-11 many years ago by the folks who brought us UNIX (Ken Thompson,
>et al).  I believe you can read more in The 'C' Programming Language.

uuuuhhhh..... My book on BCPL says it stands for Basic CPL.

It doesn't say much about CPL except it was invented at some
british university.

Other than that, you are pretty much correct.  Enough so that nobody knows
for sure which comes after C++, D or P.  I vote for P.
-- 
David Herron,  cbosgd!ukma!david, david@UKMA.BITNET, soon, david@uky.csnet.

Experience is something you don't get until just after you need it.

felsenst@entropy.UUCP (01/25/86)

Expires:
Sender:
Followup-To:

I believe BCPL stands for the Basic Cambridge Programming Language,
developed at Cambridge University in England.  It is the ancestor of
C and is widely used in Britain to do things that are done in the
U. S. in C.  In 'The C Programming Language' Kernighan and Ritchie
credit BCPL to Martin Richards and say that its influence on C was
through a language written by Ken Thompson, based on BCPL, and called
B.  B's successor was called C.  That is why C is called C.

                       Joe Felsenstein, Dept. Genetics, University 
                       of Washington, Seattle
                       ( ... uw-beaver!entropy!uw-evolution!joe)

jmg@cernvax.UUCP (jmg) (01/27/86)

In article <410@wlbr.UUCP> steve@wlbr.UUCP writes:
>The term "BCPL" is used frequently in the Developer's manuals and here
>on the net. Other than seeing the shifted pointers called BPTR's, I
>would appreciate an explanation of what this is all about. Is this all
>Sun-related?
>
>Also- Someone commented about device drivers must "be BCPL code".
>Can someone clarify? 

In the beginning was CPL: Cambridge (later Combined) Programming Language.
It was invented by people at Cambridge and London Universities. It was so
all-embracing that practically anything was allowed.
Martin Richards, of Cambridge University, cut it down to size as BCPL: the
B stands for Basic.

It is like C in many respects, but has no types at all, merely the concept
of a word as the unit. Martin used it to write a simple machine-independent
operating system called Tripos, which Metacomco (I think) used as the
basis for the Amiga OS.

I do not think it is directly related to B, which was a predecessor of C.

danny@calgary.UUCP (Danny Levinson) (01/30/86)

C was indeed derived from BCPL, via an intermediate language B.  I believe
this heritage is mentioned in "The C programming language" (Kernighan &
Ritchie).  The process of derivation seems to have been:

	1) take out all the syntactic & semantic "cleanliness" of BCPL
	   (unless, repeat, repeatwhile, endcase, valof..resultis clauses,
	   mandatory initialisations)
	2) add types in a half-hearted manner (no control over precision),
	   including a horrendous syntax for pointer declaration
	3) hide the "OCODE" (machine independent intermediate object code)
	   interface, making the language infinitely more difficult to
	   port

Of course, there are nice things about C too, such as the fact that Unix
was written in it!

-- danny levinson
   university of calgary

mwm%ucbopal@BERKELEY.EDU@caip.RUTGERS.EDU (01/30/86)

From: Mike (I'll be mellow when I'm dead) Meyer <mwm%ucbopal@BERKELEY.EDU>

Since there weren't smiley faces plastered all over this, I'll assume
he was serious and correct it (actually, giving credit to X for Y's
work is bad news, and I would probably correct that even if it *had*
smiley faces on it!).

> BCPL stands for the "Before 'C' Programming Language", and was developed
> for the PDP-11 many years ago by the folks who brought us UNIX (Ken
> Thompson, et al).  I believe you can read more in The 'C' Programming
> Language.

From the forward to "BCPL the language and its compiler" by Martin
Richards and Colin Whitby-Strevens (Cambridge University Press, 1980):
"BCPL was designed by one of the authors in 1967 (Richards)." BCLP
stands for Basic CPL. BCPL is a stripped-down version of CPL (CPL
stands for Combinded Programming Language). It was the
inspiration/model/parent-of for B, which was designed by Dennis
Ritchie and used for the utilities in early Unix systems (among other
things). B grew up to become C, the early stages of which can also be
blamed on Ritchie (ok, ok "for which Ritchie should also get credit".)
This is the source of the "next language will be either B or P"
comment in "The C Programming Language." [What we actually got was
"C++", which, as the name implies, changes the language but has the
same value (thank you, uokvax!jejones :-).]

BCPL is *odd*. It's the only language I've ever seen that let's you
change the value of a subroutine, like so:

	x()			// call x
	x = x + 16		// add 16 to x
	x()			// call (old x) + 16....
	(x+16)()		// Now call (old x) + 32....

It does have some of nice features that I wish had made it into C.

	resultis "Hack, Hack",
	<mike

milazzo@Rice.EDU@caip.RUTGERS.EDU (01/30/86)

From: Paul Milazzo <milazzo@Rice.EDU>

Mike Schwartz <mykes@3comvax.UUCP> writes:
>BCPL stands for the "Before 'C' Programming Language", and was developed
>for the PDP-11 many years ago by the folks who brought us UNIX (Ken Thompson,
>et al).  I believe you can read more in The 'C' Programming Language.

Actually, BCPL stands for Basic Combined Programming Language.  BCPL
was designed in 1967 by Martin Richards of Cambridge.  One very good
reference on BCPL is:

	BCPL, the language and its compiler
	Martin Richards and Colin Whitby-Strevens
	Cambridge University Press, 1979
	QA76.73.B17R5
	ISBN 0 521 21965 5

The first paragraph of Chapter 1 of this work gives an excellent
summary of the history and purpose of BCPL:

	The language BCPL (Basic CPL) was originally developed as a
	compiler-writing tool and, as its name suggests, is closely
	related to CPL (Combined Programming Language) which was
	jointly developed at Cambridge and London Universities.  CPL is
	described in Barron et al.[1].  BCPL adopted much of the
	syntactic richness of CPL, and strives for the same high
	standard of linguistic elegance; however, in order to achieve
	the efficiency necessary for systems-programming, its scale and
	complexity is far less than that of CPL.  The most significant
	simplification is that BCPL has only one data type -- the
	bit-pattern -- and this feature alone gives it a characteristic
	flavour which is quite different from that of CPL and most
	other current programming languages.

[1]	Barron, D. W., Buxton, J. N., Hartley, D. F., Nixon, E. and
	Strachey, C.  The main features of CPL.  Computer Journal, vol.
	6, p. 134 (1963).

Richards and Whitby-Strevens go on to describe the language, the
standard libraries, debugging facilities, and finally the compiler and
its intermediate representations.  Designed to be portable, the BCPL
compiler is itself written in BCPL, and the book includes the entire
source to the compiler front end as a "large example".  I strongly
recommend this book to anyone interested in learning more about BCPL.

				A former BCPL hacker,
				Paul G. Milazzo
				Dept. of Computer Science
				Rice University, Houston, TX
Domain:	milazzo@rice.EDU
ARPA:	milazzo@rice.ARPA
BITNET:	milazzo@ricenet, milazzo@ricecsvm
UUCP:	{cbosgd,convex,hp-pcd,shell,sun,waltz}!rice!milazzo

iwm@icdoc.UUCP (01/31/86)

In article <376@3comvax.UUCP> mykes@3comvax.UUCP (Mike Schwartz) writes:
>
>BCPL stands for the "Before 'C' Programming Language", and was developed
>for the PDP-11 many years ago by the folks who brought us UNIX (Ken Thompson,
>et al).  I believe you can read more in The 'C' Programming Language.

Well no - it stands for Basic CPL (CPL was Combined Programming Language,
which came somewhere between ALGOL 60 and ALGOL 68. It was designed and
implemented by Martin Richards at Cambridge (UK) in 1967. The line of
languages is BCPL => B => C.


-- 
Ian W Moor
  UUCP: seismo!mcvax!ukc!icdoc!iwm
  ARPA: iwm%icdoc@ucl                        
           
 Department of Computing   Whereat a great and far-off voice was heard, saying,
 Imperial College.         Poop-poop-poopy, and it was even so; and the days
 180 Queensgate            of Poopy Panda were long in the land.
 London SW7 Uk.         

hamilton@uiucuxc.CSO.UIUC.EDU (01/31/86)

re: BCPL

now, can somebody explain to me the utility of these #$%^@ shifted pointers?
i can see how they would serve to enforce boundary alignment of certain
structures in memory, but does this justify the contortions required?
or is it some kind of vestige of pdp11's with 18-bit(?) physical addresses
and 16-bit words?
	wayne hamilton

mykes@3comvax.UUCP (Mike Schwartz) (02/01/86)

did someone ask for a smiley face?

.            ---------
.           /         \
.           |  o   o  |
.           |         |
.           | \     / |
.           |  -----  |
.           \         /
.            ---------

give me a break, it's my first one.

I guess humor is lost on some people.  BCPL truly was the Before C
Programming Language, wasn't it?  I read about it in the 'C' Programming
Language by B.W. Kernighan and D. Ritchie (mine's about 10 years old now)
in the introduction.

I'm a poet,
I didn't know it,
But my feet show it,
They're long fellows.
(you can't flame me, I'm waterproof)
 -

breuel@h-sc1.UUCP (02/04/86)

> now, can somebody explain to me the utility of these #$%^@ shifted pointers?
> i can see how they would serve to enforce boundary alignment of certain
> structures in memory, but does this justify the contortions required?
> or is it some kind of vestige of pdp11's with 18-bit(?) physical addresses
> and 16-bit words?

The reason is very simple: since the language does not have data types,
this is the only way that pointer arithmetic can work in a reasonably
portable manner (i.e. without having to clutter your code with constants
or special functions to do arithmetic). Furthermore, this happens to
work extremely well on architectures on which the smallest addressable
unit of memory is the word.

						Thomas.

PS: needless to say, it has nothing whatsoever to do with PDP's in
particular. You might, at most, say that it has something to do with
DEC 10's, since they are in some sense word addressable, but
whether this had any influence on the development of BCPL, I don't know.

radford@calgary.UUCP (Radford Neal) (02/05/86)

> re: BCPL
> 
> now, can somebody explain to me the utility of these #$%^@ shifted pointers?

I take it you're refering to the likely habit of a PDP11, VAX, 68000, etc.
BCPL compiler to shift all pointers left one (maybe two) bits before use?

This is purely a vestige of non-byte-addressable machines. A BCPL program
will assume that if 'p' point to an integer array element, then 'p+1' will
point to the next array element. This is part of the model of the machine
assumed by the language. Since the compiler doesn't know that 'p' is a
pointer to an integer (or even a pointer at all, if I recall correctly), it
must really add just 1, not 2 or 4 like a C compiler would. The only way to
get this to work is to shift the pointer on dereference. The problem doesn't
arise on old machines with only one size of addressable storage unit.

This problem is, of course, the reason for C having typed pointers and
doing stride adjustment as part of pointer arithmetic.

      Radford Neal