[erlang-questions] Luerl - Lua in Erlang

Robert Virding <>
Fri Feb 24 17:16:02 CET 2012


Best to start off with why I did this:

1. I want to experiment with implementing an imperative language with mutable global state on top of Erlang. A goal was to do it in straight Erlang without extensions.

2. I am giving a talk on implementing DSL's on Erlang at the next Erlang Factory in San Francisco in March, http://www.erlang-factory.com/conference/SFBay2012 (be there, it's going to be good, the whole factory I mean), and I wanted to be able to give practical experience from implementing a real-life imperative mutable data language. Lua is a nice, small, relatively clean language and is a good choice for this. And it is actually in use. I was also considering PHP or Javascript but they are definitely not small and clean.

3. Lua is an interseting language in its own right and has some cool ideas. You can get quite far with a few simple primitives. I don't know if these would be transferable to Erlang.

4. I like implementing languages.

Because Lua has mutable data and we are implementing it on top of Erlang it will never be as fast as a "real" Lua implementation. Some valid reasons you may want to use it:

- You only have to run a little Lua code but don't want the hassle of including a Lua system.
- The Lua code are running is only in small short Lua chunks so the the extra execution time may be offset by the faster data transfer.
- You have many cores and this would allow you to run Lua in parallel.
- ...

Luerl is a subset of Lua but most of the language now works. I am working on the standard libraries but they are still lacking. Some will never been done as they are very implementation specific, for example debug.

Robert


----- Original Message -----
> Hi there,
> 
> I haven't posted to the mailing for a very long time, but this post
> got my imagination going. Can someone describe to me the
> capabilities of a Lua interpreter (i.e. this one) and what it can be
> used for? I haven't had the time to look into Lua yet, so I am a
> complete ignoramus on this subject :)
> 
> Thanks,
> 
> Rudolph
> 
> On 18 Feb 2012, at 16:59, Robert Virding wrote:
> 
> > I just want to announce that I have released the first version of
> > Luerl - Lua in Erlang. It is a Lua interpreter written in Erlang
> > which started off as a proof of concept and an experiment with
> > handling mutable data, but it grew. You can find it at:
> > 
> > https://github.com/rvirding/luerl
> > 
> > It is not a full Lua but it implements most of the language and a
> > sizeable portion of the standard libraries. The user interface is
> > lacking but I am working on that. I am also working on improving
> > the speed and extending the libraries.
> > 
> > Robert
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list