Hop Client-Side Compilation.

Florian Loitsch, Manuel Serrano · 2007

Hop is a new language for programming interactive Web applications. It aims to replace HTML, JavaScript, and server-side scripting languages (such as PHP, JSP) with a unique language that is used for client-side interactions and server-side computations. A Hop execution platform is made of two compilers: one that compiles the code executed by the server, and one that compiles the code executed by the client. This paper presents the latter. In order to ensure compatibility of Hop graphical user interfaces with popular plain Web browsers, the client-side Hop compiler has to generate regular HTML and Java-Script code. The generated code runs roughly at the same speed as hand-written code. Since the Hop language is built on top of the Scheme programming language, compiling Hop to JavaScript is nearly equivalent to compiling Scheme to JavaScript. The compiler we have designed supports the whole Scheme core language. In particular, it features proper tail recursion. However complete tail recursion optimization may slow down the generated code and is hence disabled in Hop. Most of our benchmarks were unaffected by the transformation but in the worst case programs were more than two times slower with it enabled. The techniques presented in this paper can be applied to most strict functional languages such as ML and Lisp. 1

Read the paper · More papers on PaperTik