TITLE ^

Status of Lua on Parrot

Introduction ^

Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight scripting language for any program that needs one.

The homepage is http://www.lua.org/.

The reference manual is available on http://www.lua.org/manual/.

This implementation is aligned with Lua 5.1 specifications.

PIR Compiler/Interpreter ^

Work started in languages/lua/src.

Not functional.

Perl Compiler ^

This compiler is written in Perl5 :

KNOWN PROBLEMS ^

in languages/lua/t/closure.t :

    a = {}
    local x = 20
    for i=1,10 do
        local y = 0
        a[i] = function () y=y+1; return x+y end
    end

    print(a[1]())
    print(a[1]())
    print(a[2]())

    --[[
    The loop creates ten closures (that is, ten instances of the anonymous
    function). Each of these closures uses a different y variable, while all
    of them share the same x.
    ]]

y variable is not different.

Lua Types ^

There are eight basic types in Lua, each of them is implemented by a PMC.

languages/lua/pmc/luaany.pmc provides an abstract base class for all Lua types.

languages/lua/pmc/lua.pmc is a singleton PMC what holds some static methods.

BUGS ^

Lua PMC have problems with the Parrot garbage collector : used objects are released by the GC (infant mortality ?).

So, use the option --no-gc.

TODO ^

Arguments passing in invoke method of table. Where are there ?

Weak table, weak reference.

IMPROVEMENT ^

table with a mixed array and hash (and with an efficient next method).

Lua Standard Libraries ^

Lua 5.1 defines the following standard libraries:

languages/lua/lib/luaaux.pir is the equivalent of Auxiliary Library.

languages/lua/lib/luaregex.pir implements a regex compiler using PGE.

TODO ^

Except math & table libraries, all of these libraries are incomplete.

Next Milestones ^

Understand how work PGE & TGE and write an interpreter in PIR.

Related Projects ^

Klaas-Jan Stol works on 2 projects :

See http://members.home.nl/joeijoei/.

AUTHOR ^

Francois Perrad.


parrot