[pypy-dev] Lua Frontend
Carl Friedrich Bolz
cfbolz at gmx.de
Mon Aug 13 18:17:21 CEST 2007
Jason Davies wrote:
> A couple of years ago I wrote a JIT compiler for Lua  for my
> final-year dissertation.
Is this on the web somewhere? How did it work?
> Looking through the project-ideas page  I
> noticed there might be interest in writing Lua interpreter using PyPy.
I think it would be interesting, yes. On the other hand, to me it is
unclear whether this Lua interpreter would get any users, since the
typical Lua users embed the Lua interpreter into a bigger project, which
wouldn't be easily possible with a PyPy-based Lua-VM.
> I'd be interested in doing this as a personal project. How would I go
> about getting started?
I would try to write an interpreter mirroring Lua's bytecode. This way
you don't have to care for the tedious work of parsing and
bytecode-compiling at first.
I guess it is best to start with implementing some of the data
structures of Lua, most notably tables (other data structures, like
strings and floats are probably simple to implement, they just need to
box rpython-level strings and floats). I guess you can have a naive
implementation of tables in the beginning, though.
Then you can probably start by implementing a simple interpreter for
Lua's bytecode (probably by first writing some code that reads in Lua's
bytecode and stores it nicely accessible somehow).
If you are serious about this project and want to develop it under
PyPy's umbrella you should ask for commit rights (e.g. by sending
Michael Hudson a mail, micahel at gmail.com ).
More information about the Pypy-dev