On-topic: alternate Python implementations

  • Thread starter Steven D'Aprano
  • Start date
J

John Nagle

There are other approaches. PyPy uses two interpreters and a JIT
compiler to handle the hard cases. When code does something unexpected
to other code, the backup interpreter is used to get control out of
the trouble spot so that the JIT compiler can then recompile the
code. (I think; I've read the paper but haven't looked at the
internals.)

This is hard to implement and hard to get right.

John Nagle
 
U

Ulrich Eckhardt

Am 04.08.2012 15:53, schrieb Stefan Behnel:
So, if a C++ compiler takes a .c file and compiles it with C language
semantics, it doesn't qualify as a C compiler? That implies a rather weird
definition of a C compiler, I'd say.

I'd say that even a brainfuck compiler compiling a .py file with C
language semantics can shamelessly call itself a C compiler. :p

If a C++ compiler is given C code, it may or may not produce equivalent
executables. In most non-trivial cases it will just barf on the valid C
/ invalid C++ code and refuse to compile it. In few rare cases, it will
compile the code and produce different behaviour at runtime (e.g. for
"sizeof 'a'").


Uli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top