Implementing Python for DrRacket

Authors Pedro Palma Ramos, António Menezes Leitão

Thumbnail PDF


  • Filesize: 474 kB
  • 15 pages

Document Identifiers

Author Details

Pedro Palma Ramos
António Menezes Leitão

Cite AsGet BibTex

Pedro Palma Ramos and António Menezes Leitão. Implementing Python for DrRacket. In 3rd Symposium on Languages, Applications and Technologies. Open Access Series in Informatics (OASIcs), Volume 38, pp. 127-141, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2014)


The Python programming language is becoming increasingly popular in a variety of areas, most notably among novice programmers. On the other hand, Racket and other Scheme dialects are considered excellent vehicles for introducing Computer Science concepts. This paper presents an implementation of Python for Racket and the DrRacket IDE. This allows Python programmers to use Racket libraries and vice versa, as well as using DrRacket's pedagogic features. In particular, it allows architects and designers to use Python as a front-end programming language for Rosetta, an IDE for computer-aided design, whose modelling primitives are defined in Racket. Our proposed solution involves compiling Python code into equivalent Racket source code. For the runtime implementation, we present two different strategies: (1) using a foreign function interface to borrow the data types and primitives from Python's virtual machine or (2) implementing Python's data model over Racket data types. While the first strategy is easily implemented and provides immediate support for Python's standard library and existing third-party libraries, it suffers from performance issues: it runs, at least, one order of magnitude slower when compared to Python’s reference implementation. The second strategy requires us to implement Python's data model in Racket and port all of Python's standard library, but it succeeds in solving the former's performance issues. Furthermore, it makes interoperability between Python and Racket code easier to implement and simpler to use.
  • Python
  • Racket
  • language implementations
  • compilers


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads