4 ms·
It hasn't got anything to do with parsing algorithms, which is the closest connection between this topic and the Chomsky hierarchy. Rather, it is due to the hi
by skissane 2y ago
It hasn't got anything to do with parsing algorithms, which is the closest connection between this topic and the Chomsky hierarchy.
Rather, it is due to the history of C. In the 1960s, a team in the UK (based at the University of Cambridge and the University of London) were developing a programming language called CPL–CPL was an evolution of ALGOL 60, by many accounts it suffered from the second system effect and was so complicated it is unclear if it was ever fully implemented. Like ALGOL, CPL had several different data types – integers, floating point, etc.
CPL was being developed using itself, to run on indigenous British mainframes (initially the EDSAC 2 and then Ferranti Atlas). In order to do so, they developed a simplified version of it, which came to be known as BCPL (for "Bootstrap CPL"). The designers of BCPL decided upon a rather radical simplification – only a single signed integer data type, with memory treated as one big array of that data type.
Martin Richards (of Cambridge) visited MIT in 1966, and brought BCPL with him to the US. (I think he may have actually been the first person to call it "BCPL"–prior to his visit to MIT, it wasn't really viewed as a language in its own right, just as a simplified form of CPL used as an implementation detail.) Richards wrote a BCPL implementation to run under CTSS on IBM 7094 mainframes.
At MIT, BCPL spread to the Multics project, who used it for various purposes – although they ended up choosing IBM's PL/I over BCPL as their main implementation language. From there, it in turn spread to MIT's Multics partners, GE (who sold their computing business to Honeywell in 1970) and Bell Labs.
At Bell Labs, Ken Thompson began working on his own programming language B, for DEC PDP minicomputers and GE/Honeywell mainframes. Thompson liked BCPL's semantics (the simplification of having only a single data type), but didn't like its syntax – hence, B was essentially BCPL with syntax changed to be more to Thompson's liking. Dennis Ritchie then joined Thompson in further developing B and porting it to more machines.
At some point, Ritchie began to view BCPL/B's "only one data type" approach as overly limiting, so he developed his own language, C – which started out as essentially B but with multiple data types added back in.
The thing was, early versions of C still relied heavily on BCPL/B's "everything is an int" philosophy. From what I understand, although variables could be declared to be something other than an int, at first the innards of expression compilation still assumed "int" was the only data type. So essentially, when the compiler went to compile "X.Y", by the time it processed the "." it had already forgotten what actual type X had and just saw it as an "int"
Later versions of C developed a more advanced type system, where less of BCPL/B's "everything is an int" philosophy survived. But there are still some remnants of it even in the latest C and C++ standards, in particular the "implicit promotion" rules.