tekknolagi/carp logo

tekknolagi/carp

Free

"interesting" VM in C. Let's see how this goes.

FreeFree tier
Type
Open Source

About tekknolagi/carp

Carp is an experimental virtual machine written in C, created as a learning project to understand low-level VM construction. It features a simple instruction set (including HALT, LOAD, STORE, ADD, etc.), registers, a stack, data memory, and function calls. The project is now archived and deprecated, with the author recommending the more stable RabbitVM. It was tested on multiple Linux and macOS configurations with GCC and Clang. Carp is considered pre-alpha software and is not intended for production use.

Key Features

Simple instruction set with HALT, LOAD, STORE, MOV, arithmetic and bitwise operations
Stack-based data memory and general-purpose registers
Interpreter mode for running .carp files
C API for embedding (include carp_machine.h and link libcarp.a)
Build and test with make, including optional test suite
Cross-platform: tested on Ubuntu, macOS, Arch Linux (32/64-bit) with GCC and Clang

Pros & Cons

Pros
  • Small, understandable codebase ideal for learning
  • Comprehensive instruction set covering common operations
  • Includes interpreter and C API for embedding
  • Cross-platform testing on multiple Linux and macOS versions
Cons
  • Deprecated and no longer maintained
  • Pre-alpha quality: unstable, features may change or break
  • Limited documentation beyond SYNTAX.md and README
  • Recursion support uncertain and untested
  • No longer the recommended project (author suggests RabbitVM instead)

Best For

Learning how virtual machines and low-level C programming workEducational experimentation with VM design and instruction setsBuilding a minimal runtime for educational assembly-like languages

FAQ

What is Carp?
Carp is an experimental virtual machine implemented in C, built as a learning project to explore VM internals. It provides a simple instruction set, registers, stack, and memory.
How do I build and run Carp?
Clone the repository recursively, run 'make' to build, then run the interpreter with 'make test' or directly with './carp.out -f your_file.carp'. See the README for full instructions.
Is Carp stable or ready for production?
No. The project is explicitly marked as pre-alpha, unstable, and deprecated. The author recommends using the newer RabbitVM project instead.
What platforms does Carp support?
Carp has been tested on Ubuntu 12.04/14.04, macOS 10.9.4 (Mavericks), and Arch Linux, with both GCC and Clang compilers, on 32-bit and 64-bit architectures.