License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/OASIcs.SLATE.2014.127
URN: urn:nbn:de:0030-drops-45656
URL: http://dagstuhl.sunsite.rwth-aachen.de/volltexte/2014/4565/
Go to the corresponding OASIcs Volume Portal


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

Implementing Python for DrRacket

pdf-format:
13.pdf (0.5 MB)


Abstract

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.

BibTeX - Entry

@InProceedings{ramos_et_al:OASIcs:2014:4565,
  author =	{Pedro Palma Ramos and Ant{\'o}nio Menezes Leit{\~a}o},
  title =	{{Implementing Python for DrRacket}},
  booktitle =	{3rd Symposium on Languages, Applications and Technologies},
  pages =	{127--141},
  series =	{OpenAccess Series in Informatics (OASIcs)},
  ISBN =	{978-3-939897-68-2},
  ISSN =	{2190-6807},
  year =	{2014},
  volume =	{38},
  editor =	{Maria Jo{\~a}o Varanda Pereira and Jos{\'e} Paulo Leal and Alberto Sim{\~o}es},
  publisher =	{Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik},
  address =	{Dagstuhl, Germany},
  URL =		{http://drops.dagstuhl.de/opus/volltexte/2014/4565},
  URN =		{urn:nbn:de:0030-drops-45656},
  doi =		{10.4230/OASIcs.SLATE.2014.127},
  annote =	{Keywords: Python, Racket, language implementations, compilers}
}

Keywords: Python, Racket, language implementations, compilers
Collection: 3rd Symposium on Languages, Applications and Technologies
Issue Date: 2014
Date of publication: 18.06.2014


DROPS-Home | Fulltext Search | Imprint | Privacy Published by LZI