Carp is a statically typed Lisp compiler that compiles Lisp-like syntax directly to C source code, enabling seamless integration with existing C libraries and low-level system programming. It manages memory deterministically at compile time using ownership tracking and linear types, eliminating garbage collection pauses and runtime overhead while ensuring type safety through an inferred static type system.
The language distinguishes itself through compile-time macro expansion and metaprogramming capabilities, allowing code generation and transformation before final binary output. It enforces unique ownership of values at compile time through ownership-based borrowing, preventing data races without runtime garbage collection, and supports phantom types for compile-time safety constraints. Carp provides direct interoperability with C code through inline source insertion and explicit library binding, alongside a read-eval-print loop for interactive development and macro expansion.
The project includes a module-based namespacing system with explicit import and visibility control, pattern matching control flow for deconstructing data structures, and compile-time execution for metaprogramming and conditional compilation. It offers automatic derivation of interface implementations, quasiquotation for dynamic code template construction, and comprehensive data structures including arrays, lists, maps, strings, and vectors with functional operations. Carp also provides console and file input/output, arithmetic and geometric mathematics, random number generation, descriptive statistics, pointer and raw memory management, benchmarking, and unit testing capabilities.