[TUHS] Array index history

Tony Finch dot at dotat.at
Thu Jun 8 00:58:50 AEST 2017


Michael Kjörling <michael at kjorling.se> wrote:
>
> And https://www.bell-labs.com/usr/dmr/www/bcpl.pdf page 11 (PDF page
> 14) says:
>
> > 4.7 Vector Applications
> > /.../
> > Semantics: A vector is represented by a pointer to a consecutive
> > group of words which are the elements of the vector. The pointer
> > points to the zeroth element.

That syntax is quite different from the later BCPL that I'm familiar with.
http://www.cl.cam.ac.uk/~mr10/bcplman.pdf

It has a ! indirection operator which can be both unary and binary, as in

	old BCPL	new BCPL	C

	lv x		@x		&x
	rv ptr		!ptr		*ptr
	ptr*[i]		ptr!i		ptr[i]

Richards' 1969 paper uses a down-arrow for binary !

You can use "manifest" constants for laying out a structure, e.g.

	MANIFEST { car; cdr; }

declares car and cdr to have values 0 and 1. This lets you do struct-style
indirection using the same operator as for array indexing, like in this
function definition:

	LET cadr(p) = p!cdr!car;

When I saw how ->integ is used in the 6th Edition kernel it felt very BCPL
to me.

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/  -  I xn--zr8h punycode
Shannon: Cyclonic becoming southwest, 5 or 6. Moderate or rough. Rain.
Moderate or poor.


More information about the TUHS mailing list