Fortran vs Python - Newbie Question

Terry Reedy tjreedy at udel.edu
Wed Mar 28 12:25:25 EDT 2007


"Tim Roberts" <timr at probo.com> wrote in message 
news:2e4k03l8tj9oicmn8c21vobrnvkmdstabr at 4ax.com...
| Well, I'm being a bit argumentative here, but it's hard to deny that the
| use of "compiled" in the context of .pyc (or .javac) is very different 
from
| the use of "compiled" in the context of running gcc.

Besides the fact that the object code does not corresponded to the public 
interface of any *current* processor, the compilation process is quite 
similar.  Linear source code is parsed using standard techniques to produce 
a syntax tree.  The tree is walked to produce object code in a different 
language.  A certain amount of optimization is done.

For instance, CPython compiles a 'while ' statement to a conditional jump 
past the end before the body and an absolute jump to the begining at the 
end.  I am quite sure that gcc does essentially the same thing.  If CPython 
(by 2.4, at least) recognizes the condition as a constant whose Bool value 
is True, it removes (optimizes away) the loading of the constant and the 
conditional jump that would never happen.  Again, this is the same as gcc 
will do, I am sure, with at least some flag settings.

| Once upon a time,
| Basic enthusiasts would have used the word "tokenized" to describe .pyc 
files.

Perhaps, but they would, I think, have been wrong.  Tokenized Basic to the 
best of my knowledge, is a reversibly compressed version of the source 
file.  The 'while' keyword, is there is one, is replaced by a number, but 
no parsing is done.

Terry Jan Reedy






More information about the Python-list mailing list