JUCS - Journal of Universal Computer Science 11(7): 1275-1290, doi: 10.3217/jucs-011-07-1275
Running Lua Scripts on the CLR through Bytecode Translation
expand article infoFabio Mascarenhas, Roberto Ierusalimschy§
‡ Pontifical Catholic University of Rio de Janeiro, Rio de Janeiro, Brazil§ PUC-Rio, Rio de Janeiro, Brazil
Open Access
Abstract
The .NET Common Language Runtime (CLR) aims to provide interoperability among code written in several different languages, but porting scripting languages to it, so that scripts can run natively, has been hard. This paper presents our approach for running scripts written in Lua, a scripting language, on the .NET CLR. Previous approaches for running scripting languages on the CLR have focused on extending the CLR, statically generating CLR classes from user-defined types in the source languages. They required either language extensions or restrictions on the languages' dynamic features. Our approach, on the other hand, focused on keeping the syntax and semantics of the original language intact, while giving the ability to manipulate CLR objects. We implemented a translator of Lua virtual machine bytecodes to CLR bytecodes. Benchmarks show that the code our translator generates performs better than the code generated by compilers that use the previous approaches.
Keywords
virtual machines, compilers, common language runtime, bytecodes