Lua AiR: Lua Analysis in Rascal

Lua is a general purpose script language created by Ierusalimschy, de Figueiredo and Celes [1] that is freely available on lua.org. Because it can be embedded in C and C++ programs, Lua is a popular choice for scripting in games. However, due to its dynamic types, Lua sources can be hard to analyze.

Lua AiR. In 2011, I created a tool called Static analysis of Lua in Rascal (Lua AiR) for my PhD research. Its aims are twofold. The first is to create tools to help developers raise the quality of Lua source code. The second is to provide the digital infrastructure for empirical studies of existing source repositories.

To analyze Lua, the first version of Lua AiR combined type inference with static checks of C++ function signatures against Lua function calls [2]. Unfortunately, our industry partner replaced Lua by C++, and we never conducted a large scale emprical study.

A decade passes. The AiR moniker became popular: PHP AiR, ClAiR + other AiRs, but Lua AiR remained shelved. Rascal evolved, and as a result, Lua AiR no longer functioned as intended.

Current work. In 2023 we have revived Lua AiR for an empirical study. In collaboration with MA Lighting, Linus Wagner, Jurgen Vinju and myself aim to analyze cross-language links between Lua and C++. Linus has completed his Master’s project [3].

Challenges. The current challenges include:

  • Updating the source code to the latest version of Rascal.
  • Addding Lua AiR to the digital research infrastructure, and releasing the prototype.

References

  1. Roberto Ierusalimschy. “Programming in Lua”. Lua.org, 2003. URL: https://www.lua.org/pil/
  2. Paul Klint, Loren Roosendaal, and Riemer van Rozen. “Game Developers Need Lua AiR: Static Analysis of Lua Using Interface Models”. In: Entertainment Computing. Vol. 7522. LNCS. Springer, 2012. DOI: 10.1007/978-3-642-33542-6_69
  3. Linus Wagner. “MApper: Cross-Language Call-Graph Analysis for C++, Lua and XML at MA Lighting Technology”. Cum Laude. co-supervised with Jurgen Vinju. Master’s thesis. University of Amsterdam and Vrije Universiteit, 2024