explaingit

carp-lang/carp

5,905HaskellAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

Carp is a Lisp-style programming language built for real-time apps like games and audio, it manages memory automatically without garbage collection pauses, keeping timing consistent.

Mindmap

mindmap
  root((carp))
    What it does
      No garbage collector
      Real-time safe memory
      Lisp-style syntax
    Language Features
      Static type checking
      Type inference
      Ownership tracking
      Lisp macros
    Integrations
      Calls C code directly
      SDL graphics library
      Interactive REPL
    Audience
      Game developers
      Audio programmers
      Language researchers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a game or interactive animation in a Lisp-style language without worrying about garbage collection pauses causing frame drops.

USE CASE 2

Write real-time audio synthesis software where consistent timing is critical and memory pauses are unacceptable.

USE CASE 3

Extend the language using Lisp macros to create domain-specific abstractions for game logic or graphics pipelines.

USE CASE 4

Call existing C libraries from Carp to access the full C ecosystem for performance-sensitive applications.

Tech stack

HaskellCSDLLisp

Getting it running

Difficulty · hard Time to first run · 1h+

Research project with potentially outdated docs, requires building from source and setting up SDL for the example app.

Apache 2.0, use freely for any purpose including commercial projects, just keep the copyright notice and license file.

In plain English

Carp is a programming language created for real-time applications like games, audio synthesis, and interactive visualizations. Where most modern languages rely on automatic garbage collection to manage memory (a background process that occasionally pauses execution to clean up unused data), Carp handles memory automatically without a garbage collector. This makes it suitable for situations where consistent timing matters and unexpected pauses would be noticeable. The language uses a Lisp-style syntax, meaning code is written as nested lists in parentheses, similar in appearance to Clojure. It is statically typed, so the compiler checks what types your data are before the program runs, catching errors earlier. Types are mostly inferred, meaning you do not have to declare them explicitly for every variable. The language also tracks ownership of data, which is the mechanism that lets it manage memory deterministically while still supporting a functional programming style. Carp can call existing C code directly, giving it access to the large ecosystem of C libraries used in games and performance-sensitive applications. It includes a REPL (an interactive prompt where you can type and run code immediately) and supports Lisp macros, which allow you to extend the language itself at compile time. The README notes that allocation and copying are explicit rather than hidden, so there are no surprise performance costs. The project ships with a small working example that opens a window using the SDL graphics library and animates background color changes, illustrating what Carp code looks like in practice. The README carries a warning that this is a research project and documentation may become outdated. It is licensed under Apache 2.0 and has an active Discord community for discussion.

Copy-paste prompts

Prompt 1
I want to build a simple 2D game using Carp and the SDL library. Show me how to open a window, handle keyboard input, and draw a moving sprite.
Prompt 2
How do I call an existing C function from Carp code? Walk me through linking a C library and calling one of its functions from a Carp module.
Prompt 3
Explain how Carp's ownership system works and how it manages memory without a garbage collector. Show a simple example with a struct that gets allocated and freed.
Prompt 4
I want to write a Carp macro that generates boilerplate code for a game component. Show me how Lisp macros work in Carp with a concrete example.
Open on GitHub → Explain another repo

← carp-lang on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.