What languages can be called from a Chapel program?

Hello everyone,

I am interested to know which programming languages can be called from a Chapel program (except C)? For example, if I need to call a function that is not available in Chapel (e.g., reading JSON files), with which programing languages can I develop a program and call it in my Chapel program to do this task? Thank you in advance!

Hi -

Please see Technical Notes โ€” Chapel Documentation 1.24 -- we have some C, Fortran, and Python interoperability.

In terms of calling other code from Chapel, we can call C code relatively easily. Usually other languages have a way to declare something to be callable from C and then we can use the C interoperability of Chapel to call these functions. If that is not the case, you might be able to use separate programs that communicate through files, a pipe, or ZMQ sockets (to name a few). Chapel has some Protocol Buffers support that might be useful in language interoperability settings -- see Protocol Buffers Support in Chapel โ€” Chapel Documentation 1.24 .

1 Like

Also, there is already some support for reading JSON. We are working on the API design for json support, but you can read a JSON type with readf("%jt", variable) and it includes support for records, map, and list. See for example this test code: chapel/json.chpl at main ยท chapel-lang/chapel ยท GitHub .

Thank you so much Michael for your comments. I appreciate them!

Marjan โ€”

If you have specific interoperability scenarios that you're trying to express and aren't able to sort them out, let us know and we'll help out to the best of our ability.


Thank you Brad for the support. Before starting my Ph.D. project, I am trying to figure out which programming languages can be used with Chapel. The reason for this is just in case that I need a specific function and the Chapel does not support it (So, I can call libraries developed for that function but in other programming languages inside my Chapel code).

1 Like