arXiv.itsnick.co

an independent field guide to 23 million papers from arXiv & OpenAlex — not affiliated with arXiv.org

Computer Science · Artificial Intelligence

Running Lua Scripts on the CLR through Bytecode Translation

Fabio Mascarenhas, Roberto Ierusalimschy

· TUGraz OPEN Library (Graz University of Technology)

See on the map

Abstract

Abstract. The.NET Common Language Runtime (CLR) aims to provide interop-erability among code written in several different languages, but porting script-ing 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 restric-tions 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 ob-jects. 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. Resumo. O objetivo do Common Language Runtime.NET (CLR) e ́ permitir a interoperabilidade entre código escrito em diversas linguagens, mas a execução nativa de linguagens de script no CLR tem sido difı́cil. Este artigo apresenta nossa abordagem para executar scripts escritos em Lua, uma linguagem de script, no.NET CLR. Abordagens anteriores para se executar linguagens de script no CLR enfati-zaram a extensão do CLR, gerando estaticamente novas classes CLR a partir de tipos definidos naquelas linguagens. Aquelas abordagens precisavam fazer extensões àquelas linguagens, ou restringir suas caracterı́sticas dinâmicas. Nossa abordagem, entretanto, enfatiza a conservação da sintaxe e semântica da linguagem original, enquanto da ́ a ela a habilidade de manipular objetos do CLR. Nós implementamos um tradutor de bytecodes da máquina virtual de Lua para bytecodes do CLR. Testes mostram que o código que nosso tradutor gera tem desempenho melhor do que o do código gerado por compiladores que usam as abordagens anteriores. 1.

More like this