[pypy-dev] Internship and bug report

Maciej Fijalkowski fijall at gmail.com
Wed Jun 20 12:41:21 CEST 2012


On Tue, Jun 19, 2012 at 1:30 PM, Amaury Forgeot d'Arc <amauryfa at gmail.com>wrote:

> 2012/6/19 Leonard de HARO <leonard.de.haro at 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 at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev
>
>
Yes, it is an RPython oddity but I believe even a documented one!
http://doc.pypy.org/en/latest/coding-guide.html#rpython-definition look for
lists.

Cheers,
fijal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120620/0319ffb3/attachment.html>


More information about the pypy-dev mailing list