Abstract
We provide formal semantics for a large subset of the Lua programming language, in its version 5.2. We validate our model by mechanizing it and testing it against the test suite of the reference interpreter of Lua, obtaining evidence that our model accurately represents the language.
We target both a PL semanticist "not necessarily versed in Lua", and a Lua developer - not necessarily versed in semantic frameworks. To the former, we present the peculiarities of the language, and how we model them in a modular small-step operational semantics, using concepts from Felleisen-Hieb's reduction semantics with evaluation contexts. Moreover, we mechanize and test the model in PLT Redex, the de facto tool for reduction semantics.
To the reader unfamiliar with such concepts, we provide a gentle introduction to the model. It is our hope that developers of the different Lua implementations and dialects understand the model and consider it both for testing their work and for experimenting with new language features.
- M. Bodin, A. Chargueraud, D. Filaretti, P. Gardner, S. Maffeis, D. Naudziuniene, A. Schmitt, and G. Smith. A trusted mechanised JavaScript specification. In POPL ’14, 2014.Google Scholar
- M. Felleisen, R. B. Finlder, and M. Flatt. Semantics Engineering with PLT Redex. The MIT Press, 2009.Google Scholar
Digital Library
- A. Guha, C. Saftoiu, and S. Krishnamurthi. The essence of JavaScript. In ECOOP ’10, 2010. Google Scholar
Cross Ref
- R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. The evolution of an extension language: a history of Lua. In Brazilian Symposium on Programming Languages, 2001.Google Scholar
- R. Ierusalimschy, L.H. de Figueiredo, and W. Celes. The evolution of an extension language: a history of lua. In Brazilian Symposium on Programming Languages, 2001.Google Scholar
- A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. TOPLAS, 23:396–450, 2001. Google Scholar
Digital Library
- R. Krebbers and F. Wiedijk. Separation logic for non-local control flow and block scope variables. In FOSSACS’13, 2013. Google Scholar
Digital Library
- Hanshu Lin. Operational semantics for Featherweight Lua. Master’s thesis, San JosÃľ State University, march 2015.Google Scholar
- S. Maffeis, J. C. Mitchell, and A. Taly. An operational semantics for JavaScript. In APLAS ’08, 2008. Google Scholar
Digital Library
- A. M. Maidl, F. Mascarenhas, and R. Ierusalimschy. A formalization of Typed Lua. In DLS ’15, 2015. Google Scholar
Digital Library
- G. Morrisett, M. Felleisen, and R. Harper. Abstract models of memory management. In FPCA ’95, 1995. Google Scholar
Digital Library
- A. L. Moura and R. Ierusalimschy. Revisiting coroutines. TOPLAS, 31(2):6:1–6:31, February 2009.Google Scholar
Digital Library
- J. G. Politz, M. J. Carroll, B. S. Lerner, J. Pombrio, and S. Krishnamurthi. A tested semantics for getters, setters, and eval in JavaScript. In DLS ’12, 2012. Google Scholar
Digital Library
- J. G. Politz, A. Martinez, M. Milano, S. Warren, D. Patterson, J. Li, A. Chitipothu, and S. Krishnamurthi. Python: The full monty: A tested semantics for the Python programming language. In OOPSLA ’13, 2013.Google Scholar
- L. H. de Figueiredo R. Ierusalimschy and W. Celes. Lua – an extensible extension language. Software: Practice and Experience, 26(6):635–652, 1996. Google Scholar
Digital Library
- ravilang.github.io ), and Typed Lua [ 10 ].Google Scholar
Index Terms
Decoding Lua: formal semantics for the developer and the semanticist
Recommendations
Decoding Lua: formal semantics for the developer and the semanticist
DLS 2017: Proceedings of the 13th ACM SIGPLAN International Symposium on on Dynamic LanguagesWe provide formal semantics for a large subset of the Lua programming language, in its version 5.2. We validate our model by mechanizing it and testing it against the test suite of the reference interpreter of Lua, obtaining evidence that our model ...
From Specification to Testing: Semantics Engineering for Lua 5.2
AbstractWe provide a formal semantics for a large subset of the Lua programming language, in its version 5.2. The semantics is a major part of an ongoing effort to construct reliable tools to analyze Lua code. In this work, we present the details of ...
Efficient compilation of Lua for the CLR
SAC '08: Proceedings of the 2008 ACM symposium on Applied computingMicrosoft's Common Language Runtime offers a target environment for compiler writers that provides a managed execution environment and type system, garbage collection, access to OS services, multithreading, and a Just-In-Time compiler. But the CLR uses ...







Comments