skip to main content
article

Decoding Lua: formal semantics for the developer and the semanticist

Published:24 October 2017Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle Scholar
  2. M. Felleisen, R. B. Finlder, and M. Flatt. Semantics Engineering with PLT Redex. The MIT Press, 2009.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. Guha, C. Saftoiu, and S. Krishnamurthi. The essence of JavaScript. In ECOOP ’10, 2010. Google ScholarGoogle ScholarCross RefCross Ref
  4. 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 ScholarGoogle Scholar
  5. 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 ScholarGoogle Scholar
  6. A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. TOPLAS, 23:396–450, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Krebbers and F. Wiedijk. Separation logic for non-local control flow and block scope variables. In FOSSACS’13, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Hanshu Lin. Operational semantics for Featherweight Lua. Master’s thesis, San JosÃľ State University, march 2015.Google ScholarGoogle Scholar
  9. S. Maffeis, J. C. Mitchell, and A. Taly. An operational semantics for JavaScript. In APLAS ’08, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. M. Maidl, F. Mascarenhas, and R. Ierusalimschy. A formalization of Typed Lua. In DLS ’15, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. G. Morrisett, M. Felleisen, and R. Harper. Abstract models of memory management. In FPCA ’95, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. L. Moura and R. Ierusalimschy. Revisiting coroutines. TOPLAS, 31(2):6:1–6:31, February 2009.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle Scholar
  15. L. H. de Figueiredo R. Ierusalimschy and W. Celes. Lua – an extensible extension language. Software: Practice and Experience, 26(6):635–652, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. ravilang.github.io ), and Typed Lua [ 10 ].Google ScholarGoogle Scholar

Index Terms

  1. Decoding Lua: formal semantics for the developer and the semanticist

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 52, Issue 11
        DLS '17
        November 2017
        86 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3170472
        Issue’s Table of Contents
        • cover image ACM Conferences
          DLS 2017: Proceedings of the 13th ACM SIGPLAN International Symposium on on Dynamic Languages
          October 2017
          86 pages
          ISBN:9781450355261
          DOI:10.1145/3133841

        Copyright © 2017 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 24 October 2017

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!