2012/6/19 Leonard de HARO <leonard.de.h...@ens.fr> > Hello, > > I'm a french undergraduated CS. student currently doing an internship in > Santigo's University under the supervision of Eric Tanter. I'm working on > the meta JIT compiler provided in the pypy project, trying to document > it's performance on different kind of interpreters. I started two weeks > ago. > > I have a problem with the translation toolchain. I've been writing an > interpreter for a small language inspired by Shriram Krishnamurthi's F1WAE > from his book "Programming Languages: Application and Interpretation". > My problem is the following: I have an interpreter that seems to work > perfecty (at least on my examples) when I use pypy interpreters, but > whenever I translate it, execution fails. The fact is: I have identified > the source of the problem but I don't understand it. > If you look at the parser file, on line 184, there is a "print" > instruction. With this instruction on comment, the translated version of > RPinterpret executed on test10run10 gets a Stack Overflow. Use a > translated version of the same file (RPinterpret.py) with the print > instruction in parser.py, you get the normal behavior (which you have > anyway using "pypy RPinterpret.py test10runs10").
> Looks like a bug, but since I'm a beginer (both on this work and on Python > in general), maybe I have missed something. > Hum, looks like a RPython oddness. It seems that you have to catch IndexError for IndexError to be raised by the operation... def CutWord(string, i): try: if string[i] in (' ', '\n', '\t'): return i except IndexError: return i return CutWord(string, i+1) But I think a loop would be much more efficient... -- Amaury Forgeot d'Arc
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev