Hello Samuele, [Samuele Pedroni Tue, Jun 17, 2003 at 05:31:48PM +0200]
At 14:39 17.06.2003 +0200, holger krekel wrote:
Hello pypy and hello Armin :-)
ASFAIK your idea of restricted python is to implement a TranslationObjSpace which emits C-code. We would e.g. run the interpreter (by running e.g. tests) against StdObjSpace and use the TranslationObjSpace to generate a C-file which is - when compiled and run - our restricted interpreter which can execute bytecode.
I don't know but i think going the TranslationObjSpace way might turn into complicated code. For example how do you "detect" a loop from an objectspace's POV? It just sees a series of a series of ObjSpace-Method accesses and it seems hard to reverse engineer the loop. (I guess you say this loop-unfolding is basically a space/time trade-off :-)
please correct me, if/where i am wrong.
you can use some kind of ObjSpace to do abstract interpretation, but you can't simply use all the normal interpreter mechanism.
You either start from the AST and there loops and control flow are clear, or from the bytecode and use it as it is as flow graph, each bytecode is a node and there are edges from each bytecode to its successors in case of execution, or reduce it to basic blocks etc...
but this means you can't simply implement a TranslationObjSpace and use it to generate the C-code for a restricted Python interpreter, right? cheers, holger