Hostname: page-component-74656f9884-2dmjx Total loading time: 0 Render date: 2026-11-10T07:14:25.370Z Has data issue: false hasContentIssue false

Lightweight compilation of (C)LP to JavaScript*

Published online by Cambridge University Press:  05 September 2012

JOSE F. MORALES
Affiliation:
IMDEA Software Institute, Madrid, Spain (e-mail: josef.morales@imdea.org)
RÉMY HAEMMERLÉ
Affiliation:
School of Computer Science, Technical University of Madrid (UPM), Spain (e-mail: remy@clip.dia.fi.upm.es)
MANUEL CARRO
Affiliation:
IMDEA Software Institute, Madrid, Spain and School of Computer Science, Technical University of Madrid (UPM), Spain (e-mail: manuel.carro@imdea.org, manuel.hermenegildo@imdea.org, mcarro@fi.upm.es, herme@fi.upm.es)
MANUEL V. HERMENEGILDO
Affiliation:
IMDEA Software Institute, Madrid, Spain and School of Computer Science, Technical University of Madrid (UPM), Spain (e-mail: manuel.carro@imdea.org, manuel.hermenegildo@imdea.org, mcarro@fi.upm.es, herme@fi.upm.es)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

We present and evaluate a compiler from Prolog (and extensions) to JavaScript which makes it possible to use (constraint) logic programming to develop the client side of web applications while being compliant with current industry standards. Targeting JavaScript makes (C)LP programs executable in virtually every modern computing device with no additional software requirements from the point of view of the user. In turn, the use of a very high-level language facilitates the development of high-quality, complex software. The compiler is a back end of the Ciao system and supports most of its features, including its module system and its rich language extension mechanism based on packages. We present an overview of the compilation process and a detailed description of the run-time system, including the support for modular compilation into separate JavaScript code. We demonstrate the maturity of the compiler by testing it with complex code such as a CLP(FD) library written in Prolog with attributed variables. Finally, we validate our proposal by measuring the performance of some LP and CLP(FD) benchmarks running on top of major JavaScript engines.

Information

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2012