CSP as a domain-specific language embedded in python and jython

Sarah Mount*, Mohammad Hammoudeh, Sam Wilson, Robert Newman

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

5 Scopus citations

Abstract

Recently, much discussion has taken place within the Python programming community on how best to support concurrent programming. This paper describes a new Python library, python-csp, which implements synchronous, message-passing concurrency based on Hoare's Communicating Sequential Processes. Although other CSP libraries have been written for Python, python-csp has a number of novel features. The library is implemented both as an object hierarchy and as a domain-specific language, meaning that programmers can compose processes and guards using infix operators, similar to the original CSP syntax. The language design is intended to be idiomatic Python and is therefore quite different to other CSP libraries. python-csp targets the CPython interpreter and has variants which reify CSP process as Python threads and operating system processes. An equivalent library targets the Jython interpreter, where CSP processes are reified as Java threads. jython-csp also has Java wrappers which allow the library to be used from pure Java programs. We describe these aspects of python-csp, together with performance benchmarks and a formal analysis of channel synchronisation and choice, using the model checker SPIN.

Original languageEnglish
Pages (from-to)293-309
Number of pages17
JournalConcurrent Systems Engineering Series
Volume67
DOIs
StatePublished - 2009
Externally publishedYes

Keywords

  • CSP
  • Domain-specific languages
  • Dynamic languages
  • Python

ASJC Scopus subject areas

  • General Computer Science
  • General Engineering

Fingerprint

Dive into the research topics of 'CSP as a domain-specific language embedded in python and jython'. Together they form a unique fingerprint.

Cite this