[pypy-dev] Seeking advice re. implementing an interpreter in RPython

Carl Friedrich Bolz cfbolz at gmx.de
Thu Jun 17 13:40:10 CEST 2010


Hi Tom,

On 06/17/2010 11:19 AM, Tom Locke wrote:
> Thanks for the welcome, and how nice it is to find a project on a
> European time-zone, and not have to wait for those sleepy Americans
> to wake up : ) By way of an introduction, did any of you guys notice
>  "Logix" a few years back? On-the-fly syntax extension and lisp-ish
> macros for Python. I'm the guy that did that. Now abandoned sadly.
>
> I am building what you might call a macro language or a template
> language for code-generation. It is up and running in prototype form,
> but way too slow.
>
> I must confess to having jumped ship - I am mainly a Ruby guy these
> days, and the prototype is in Ruby. But RPython is interesting enough
> to perhaps bring me back - for this project at least - so
> congratulations for that. Amazing project.
>
> OK, to get down to business - I'll be starting with the parser.

In general the PyPy attitude is that parsers are totally uninteresting.

> I notice there is a packrat parser in the rlib directory. If that is
> in a working state I'll be a happy man, as my existing grammar is
> for a Ruby packrat parser (Treetop). I am guessing that the 'r' in
> 'rlib' means RPython?

Yes, that's correct.

> Which I'm hoping means the packrat parser might be reasonably fast?

As I am wrote the stuff in the rlib/parsing directory I guess I should
answer that. There are actually two different packrat-parsing approaches 
in the parsing directory. Both of them are not particularly polished or 
particularly fast. They might still be useful for you, but you have to 
try and see.

> Any pointers to getting started with the packrat parser (or some
> other if you don't advise that) much appreciated!

There is this:

http://codespeak.net/pypy/dist/pypy/doc/rlib.html#parsing

Apart from that, you probably have to look at the code or the tests in 
rlib/parsing.

Cheers,

Carl Friedrich



More information about the Pypy-dev mailing list