Running Lua Scripts on the CLR through Bytecode Translation
Fabio Mascarenhas (Departamento de Informatica, PUC-Rio, Brasil)
Roberto Ierusalimschy (Departamento de Informatica, PUC-Rio, Brazil)
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: bytecodes, common language runtime, compilers, virtual machines