Cinder is a small systems language with C compatibility, ?T optionals,
!T errors, slices, and an LLVM backend.
This guide teaches Cinder through complete, runnable programs. Each page shows a program and its output.
- Hello, World
- Variables
- Types and Literals
- Functions
- Control Flow
- Structs
- Enums
- Arrays and Slices
- Optionals and Errors
- defer
- Compile-Time Code
- Pointers
- Function Pointers
- Calling C: extern and FFI
- Modules
- The Standard Library
- Bare Metal: Writing a Kernel
The compiler is ./cinder (a wrapper around main.rb).
It needs Ruby and an LLVM toolchain (llvm-as, llc, as, cc).
./cinder check hello.cnd # parse and type-check only
./cinder build hello.cnd --emit=bin -o hello # native executable
./hello # run itPass --mode=release for optimized builds.
The examples in this guide are checked automatically by test/docs_test.rb.
If an example stops compiling, the test suite fails.
- Every program starts with
use "std/io.cnd";when it prints. fn main() -> i32is the entry point; its return value is the exit code.- Output blocks show the expected result of the preceding program.
- Code fragments (no
fn main) illustrate one idea and are not runnable alone.