/luna

A luajit bytecode interpreter written in RPython

Primary LanguagePythonOtherNOASSERTION

Luna

Build Status Coverage Status

Luna is a bytecode register interpreter for Lua. At the moment it uses Luajit to compile Lua files to bytecode and interprets it.

You'll need to have a few dependencies installed. You can get them with pip install -r requirements.txt. Then make sure you have a recent checkout of PyPy and have it on your PYTHONPATH. Finally you need a recent version of luajit (luajit -b is used to generate the bytecode).

To run the tests::

$ py.test

To translate run::

$ python translate.py

This will compile Luna, it'll take about 30 seconds.

To run Luna directly on top of Python you can do::

$ python -m luna /path/to/file.lua

TODO

  • Compiler in Rpython
  • Interators
  • JIT
  • more standard library functions

Features

At the moment, Luna supports most of the Lua standard constructs, except iterators.

Following parts of the standard library (the code can be found in luna/modules) have been implemented:

  • Builtins
  • assert
  • print
  • loadfile
  • loadstring
  • tonumber
  • type
  • math
  • floor
  • sin
  • mod
  • table
  • concat
  • insert
  • remove
  • string
  • find
  • match
  • gsub