Python Written in C?

Grant Edwards grante at visi.com
Tue Jul 22 08:51:48 EDT 2008


On 2008-07-22, Larry Bates <larry.bates at websafe.com`> wrote:
> Grant Edwards wrote:
>> On 2008-07-22, Larry Bates <larry.bates at websafe.com`> wrote:
>> 
>>> You talk about "writing it in assembly language for each MPU
>>> chip".  Actually it is even better than that.  We now have
>>> these modern inventions, called compilers that do that type of
>>> work for us.  They translate high level instructions, not 
>>> into assembler but into machine language.
>> 
>> Actually, all of the compilers I'm familiar with (gcc and a
>> handful of cross compilers for various microprocessors)
>> translate from high-level languages (e.g. C, C++) into
>> assembly, which is then assembled into relocatable object
>> files, which are then linked/loaded to produce machine
>> language.
>> 
> I just learned something I did not know.  I was under the
> impression that they translated directly to machine code
> without ever actually generating Assembler text files.

There may indeed be compilers that work that way.  On Unix
systems (which is what I work with) compilers have
traditionally generated assembly language files.

> Seems like a waste to generate the text and turn around run
> that through the assembler, but what do I know.  I guess that
> way the compiler can have pluggable assembler back-ends.

Since you probably need an assembler anyway, generating
assembly-language in the compiler prevents you from having to
duplicate a bunch of object-code-generation code in two places.

-- 
Grant Edwards                   grante             Yow! Okay ... I'm going
                                  at               home to write the "I HATE
                               visi.com            RUBIK's CUBE HANDBOOK FOR
                                                   DEAD CAT LOVERS" ...



More information about the Python-list mailing list