Google Summer of Code wrap-up: LabLua

Friday, December 4, 2015

LabLua is a lab at PUC-Rio dedicated to research on programming languages, with emphasis on the Lua programming language. Lua is a powerful, fast, lightweight, embeddable scripting language that is used in many industrial applications and on several embedded systems and games.

This was our second year in Google Summer of Code (GSoC) and we feel our six completed projects made for a very successful outcome. Five of our projects were selected from our Ideas List, and one was proposed by the student herself! It was great to not only see students contributing code to the project, but to witness their enthusiasm for project design as well. Below are some brief highlights of this year's projects:

Port Lua Test Suite to NetBSD Kernel (Guilherme Salazar)
The Lua interpreter was initially ported to the NetBSD kernel during GSoC 2010, allowing users to write kernel extensions using Lua scripts. During GSoC 2015, Guilherme worked on porting the Lua test suite to the NetBSD kernel. He adapted test scripts to eliminate dependencies on floating-point numbers and the operating system itself.

Guilherme also ported and reimplemented part of the Lua standard libraries (e.g., math and io) for satisfying test dependencies. Moreover, he found important bugs on the Lua kernel port.

Elasticsearch Lua client (elasticsearch-lua) (Dhaval Kapil)
Elasticsearch is a distributed and scalable search engine written in Java that, besides its native transport protocol (Java to Java), offers a very complete REST API accessed through JSON. Dhaval built elasticsearch-lua, an initial client for the Lua language following a model similar to other existing clients, such as the clients written in Python and PHP.

Dhaval had the freedom to decide how to model the object oriented API and how to build tests during development. With elasticsearch-lua, programmers can now access most Elasticsearch functionalities, such as index, read, update, delete and search documents.

Port an SDL-based C++ open source game to Céu (Alexander Tkachov)
Céu is a programming language that targets the development of reactive applications such as video games. It features first-class support for events and parallel compositions for lines of execution. For this project, we wanted to port an open source game of considerable size from C++ to Céu.

Alexander chose the game Pingus (a Lemmings-like game for Linux) with a codebase of around 40k lines of code. An important requirement of our project was to do a "live port" of the game, in which the game remained fully functional while portions of it were ported to Céu and the rest remained in C++. In this project, Alexander faced two main challenges: applying the Céu idioms to the new code and keeping the old C++ code working across the language boundaries. Even though the code base was too big for a 3-month period, Alexander was able to port around half of the game, including its core (i.e., the game levels).

Add support for WSDL generation to LuaSOAP (Victor Dias)
LuaSOAP is a library to ease the use of SOAP, the Simple Object Access Protocol. It provides a very simple API that converts Lua tables to and from XML documents. It offers two modules to help providing (server) and consuming (client) SOAP services.

Victor developed a module to help the generation of WSDL (Web Services Description Language) documents for the services implemented by the server. This new module traverses the service description (a Lua table, built by the programmer by hand, because Lua doesn't have this kind of information) and produces the WSDL description for it. This new module will be integrated into the next version of LuaSoap.

Design of TIER encoding and its implementation in Lua (Lukas Borin)
TIER is an experimental language-independent binary encoding format, designed by this project's mentor, similar in purpose to formats like XML, JSON and Google's Protocol Buffers. TIER is designed to optionally support self-describing encodings that include meta-information about the serial structure of the encoded data; this meta-information can be used to support dynamic verifications or automatic decoding.

Lukas improved TIER's design and also wrote the first implementation of a Lua library that provides support for TIER encodings. He also wrote TIER's basic documentation and some tutorials on its usage. The TIER library supports custom mappings of the various TIER serial structures to specific Lua values. On top of this custom mapping support, Lukas also developed some predefined mappings for usual Lua values and a framework to facilitate the creation of mappings for usual Lua structures, such as sequences, maps, sets, etc.

Improvements to the Sailor Web Framework (Etiene Dalcol)
Sailor is an MVC web framework for Lua. Its distinguishing feature is that it easily lets the programmer write Lua code for running both in the server and in the browser. It was created by Etiene Dalcol, and she submitted a project proposal to us with a series of planned improvements.

During GSoC 2015, she worked on three fronts for improving the framework: the first was a better test suite, the second was better documentation for the project, and the third was a series of improvements for the feature of running Lua code on the browser, with the possibility of having Lua code in the browser request new modules on demand from the server, and breaking the original dependency on also having node.js installed on the server.

All of the GSoC contributions are already committed to the Sailor project repository at Github, and the test suite is already part of Sailor 0.4, the latest public release of the project.

By Ana Lúcia de Moura, Adjunct Professor at PUC-Rio and LabLua Administrator