Programming language failings [was Re: strangest systems I've sent email from]

Guy Sotomayor Jr ggs at shiresoft.com
Sun May 1 18:29:35 CDT 2016


> On Apr 30, 2016, at 6:39 AM, Diane Bruce <db at db.net> wrote:
> 
> On Fri, Apr 29, 2016 at 03:55:35PM -0700, Chuck Guzis wrote:
>> Those who claim that there's not much difference between C and assembly
>> language have never run into a true CISC machine--or perhaps they rely
>> only on libraries someone else has written.
> 
> Now wait a minute here. C is a very old language. When it was first written
> as a recursive descent compiler, compiler technology was very primitive.
> K&R style code with primitive compilers pretty much resulted in high level
> assembler. Look at the keyword 'register' and the rationale given for it.
> 
>> 
>> Writing a true global optimizing compiler that generates code as good as
>> assembly is a nearly impossible task.  When you are dealing with a
>> target machine with a large CISC set, it's really tough.
> 
> Now on that we furiously agree. One problem has been getting that through
> to people who insist that C is still a high level assembler and has
> not changed from the time when it was a hand crafted recursive descent
> LR to the modern compiler with all the lovely optimisations we can do.
> 

What does a recursive decent parser to do with code generation and
optimization?

All of the compilers I wrote (admittedly it’s been decades since I wrote one
from scratch) all had recursive decent parsers.  The output from that was a
“program tree” that the global optimizer walked to do transforms that were
the “global” optimizations.  The code generator took the output, generated
code for a synthetic machine.  That was then gone over by the target code
generator to do register allocation and code generation to the final ISA.  The
result of this flow generated pretty respectably optimized code.  The parser
was *very* removed from the code generation.  Frankly, I fail to see what
the implementation choice for the parser has on the quality (or lack thereof)
of the generated code.

> The best way of viewing it is to acknowledge that modern C is effectively
> a new language compared to old K&R C that had no prototypes. 

ANSI C is the “modern C” vs K&R C.  However, even ANSI C evolves
every few years to what is effectively a new variant of C that maintains
some backwards compatibility with older versions.

TTFN - Guy


More information about the cctalk mailing list