Path: utzoo!mnetor!uunet!husc6!bbn!uwmcsd1!leah!itsgw!steinmetz!davidsen From: davidsen@steinmetz.steinmetz.UUCP (William E. Davidsen Jr) Newsgroups: comp.arch Subject: Re: C machine Message-ID: <8226@steinmetz.steinmetz.UUCP> Date: 16 Dec 87 16:33:34 GMT References: <7535@alice.UUCP> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 32 One of the interesting things about B was that there were no types. There were only objects. Therefore all objects had to be large enough to handle a pointer. On machines which didn't support hardware byte addressing there was a function (I *think* called char) which performed the accesses. Arrays were allocated as pointers and vectors. If I declared a[10], a variable a was created, and a vector length ten. This is why in C the name of an array behaves like an address. In addition, in B A[B] is the same as B[A], since both are evaluated as *(A+B). The original B compiler I saw was a total of 17 pages of code, and produced assmebler source. The output of pass one was pseudo code, and could be interpreted if desired. As I recall there was only a false jump, not a true, so code resulting in a branch on true, such as "if (a < b) break;" would generate a jump around an unconditional jump. In about 1972 I developed a language called IMP, based on the ideas of B. I also developed a peephole optimizer which operated on the pseudo code (pass 1.5). The compiler was implemented on both GECOS (as it was spelled then) and CP/M-80, and would crosscompile in either direction (but only assmebler source went from CP/M to GECOS. This was my first compiler, and in keeping with being typeless but needing floating point, use floating operators instead. As I recall the assignment operator was changed to ":=" ala Pascal, equality was just "=", and inequality was "<>" like BASIC. This made the code somewhat easier to read if you didn't know the language. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me