"Limin Fu" <fu**********@yahoo.com> wrote in message
news:20***********************@web80907.mail.scd.y ahoo.com...
To clarify, I mean the internal structure and design
of python interpreter. Any hint? Thanks.
Ah... The interpreters (plural) are a separate issue from the language
itself (a Python program is a list of Python statements, etc). We'll
presume that you specifically mean the CPython interpreter, as opposed to
Jython, Viper, Ironman, PyPy, Parrot, or the human brain. For CPython:
human or other source code generator ==> Python source code
CPython compile phase:
lexer ==> tokens
parser ==> ast tree
byte code generator ==> byte codes for Python virtual machine
(see the Lib Ref chapter on the dis module for VM commands)
CPython runtime phase:
code evaluator ==> computations
(see source file ceval.c for the link between byte codes and C
functions)
CPython is currently both the reference implementation and the most
commonly used implementation. Both facts could change in the future,
possibly even with divergence between the two roles. Since Python is meant
to be a practical computer language as well as an abstract algorithm
language (for humans), a reference implementation is needed to show that
proposed language features can be sensibly implemented.
Terry J. Reedy