A Surprisingly Simple Lua Compiler

被引:1
|
作者
Gualandi, Hugo Musso [1 ]
Ierusalimschy, Roberto [1 ]
机构
[1] Pontificia Univ Catolica Rio de Janeiro, Rio de Janeiro, Brazil
关键词
dynamic languages; interpreters; partial evaluation; compilers; just-in-time compilers;
D O I
10.1145/3475061.3475077
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Dynamically-typed programming languages are often implemented using interpreters, which offer several advantages in terms of portability and flexibility of the implementation. However, as a language matures and its programs get bigger, programmers may seek compilers, to avoid the interpretation overhead. In this study, we present LuaAOT, a simple ahead-of-time compiler for Lua. The compiler is derived from the Lua interpreter and it exemplifies an old idea of using partial evaluation to produce a compiler based on an existing interpreter. Our contribution is to apply this idea to a well-established programming language. We show that with a quite modest effort it is possible to implement an efficient compiler that covers the entirety of Lua, including coroutines and tail calls. The whole implementation required less than 500 lines of new code. For this effort, we reduced the running time of our benchmarks from 20% to 60%.
引用
收藏
页码:1 / 8
页数:8
相关论文
共 50 条
  • [21] From the simple to the surprisingly complex - An incremental study of elasticity
    Allen, Bradley
    PHYSICS TEACHER, 2019, 57 (08): : 570 - 571
  • [22] Surprisingly Simple Mechanical Behavior of a Complex Embryonic Tissue
    von Dassow, Michelangelo
    Strother, James A.
    Davidson, Lance A.
    PLOS ONE, 2010, 5 (12):
  • [23] SICIoT: A simple instruction compiler for the Internet of Things
    Zuniga, Angel
    Sierra, Gerardo
    Bel-Enguix, Gemma
    Gomez, Javier
    INTERNET OF THINGS, 2020, 12
  • [24] SIMPLE COMPILER CORRECTNESS - A TUTORIAL ON THE ALGEBRAIC APPROACH
    COLLIER, PA
    AUSTRALIAN COMPUTER JOURNAL, 1986, 18 (03): : 128 - 135
  • [25] The molecular basis of TCR germline bias for MHC is surprisingly simple
    Garcia, K. Christopher
    Adams, Jarrett J.
    Feng, Dan
    Ely, Lauren K.
    NATURE IMMUNOLOGY, 2009, 10 (02) : 143 - 147
  • [26] Breathtaking Brassiere: A Mysterious Case Of Dyspnea With A Surprisingly Simple Explanation
    Damodaran, A.
    Rubinstein, I.
    AMERICAN JOURNAL OF RESPIRATORY AND CRITICAL CARE MEDICINE, 2017, 195
  • [27] BREATHTAKING BRASSIERE - A MYSTERIOUS CASE OF DYSPNEA WITH A SURPRISINGLY SIMPLE EXPLANATION
    Damodaran, A.
    Rubinstein, I.
    JOURNAL OF INVESTIGATIVE MEDICINE, 2017, 65 (04) : 870 - 870
  • [28] The molecular basis of TCR germline bias for MHC is surprisingly simple
    K Christopher Garcia
    Jarrett J Adams
    Dan Feng
    Lauren K Ely
    Nature Immunology, 2009, 10 : 143 - 147
  • [29] Coroutines in Lua
    de Moura, AL
    Rodriguez, N
    Ierusalimschy, R
    JOURNAL OF UNIVERSAL COMPUTER SCIENCE, 2004, 10 (07) : 910 - 925
  • [30] HIGH-SPIN MOLECULAR ROTATION SPECTRA ARE SURPRISINGLY SIMPLE
    SCHWARZSCHILD, BM
    PHYSICS TODAY, 1984, 37 (07) : 17 - 20