cmetal 0.5.0

A self-contained learning environment for advanced C, inspired by rustlings
cmetal-0.5.0 is not a library.

CI Docs crates.io

                     _        _ 
  ___ _ __ ___   ___| |_ __ _| |
 / __| '_ ` _ \ / _ \ __/ _` | |
| (__| | | | | |  __/ || (_| | |
 \___|_| |_| |_|\___|\__\__,_|_|

A self-contained learning environment for advanced C. (formerly known as clings)

cmetal follows the model of rustlings: you learn by fixing broken C code. The goal is not to teach every corner of C, but the C that appears in production systems.

Each exercise is a .c file with a defect. You open it, fix it and save it. cmetal compiles it again, runs the tests and the sanitizers where the exercise has them, and reports the result.

cmetal has 62 exercises across 20 topics, in two parts. The foundations cover pointers, memory, undefined behavior, strings, structs, function pointers, const, error handling and bitwise operations. The implementation track applies them to the C of interpreters, compilers and binary formats: encodings, tagged unions, hash tables, arenas, a mark-and-sweep garbage collector, NaN boxing and bytecode.

The CLI is written in Rust, and the exercises are C11. cmetal supports Linux and macOS. On Windows, use WSL: the native toolchains do not have the sanitizers that the exercises need.

📖 Documentation: how to install, watch mode, the curriculum, and how verification works.

Quick start

You need gcc or clang with C11 support. Then:

brew install cdelmonte-zg/tap/cmetal
# or, with a Rust toolchain: cargo install cmetal

cmetal init my-cmetal-course
cd my-cmetal-course
cmetal

The binary contains the curriculum, so you do not need a clone. Edit the files under my_exercises/, save them and read the result. Press h for a hint. When an exercise passes, cmetal writes the official solution to my_solutions/, and you can compare it with yours. cmetal compiles with gcc by default. Run cmetal --compiler clang to use clang.

Install describes the other ways to install (prebuilt binaries, build from source), and how to upgrade and uninstall.

Screenshots

Welcome screen

Exercise in progress

You edit a .c file and save it. cmetal compiles it again and shows the result.

Questions and feedback

Questions about an exercise, and ideas for new ones, go in Discussions. Bugs in the CLI or in an exercise go in Issues.

Contributing

An exercise is a .c file with a defect, its tests, its solution, and hints in info.toml. Every exercise must fail as shipped, and every solution must pass. scripts/check_exercises.py and CI check this rule. CONTRIBUTING.md describes how to add an exercise, and VISION.md describes the plans of the project.

License

MIT