Introduction
Nic is a systems programming language that merges mathematical rigor with practical engineering. It emphasizes explicitness, compositional reasoning, and deterministic execution—making it ideal for compilers, operating systems, and embedded systems where predictable performance matters.
Why Nic?
- Explicit memory management: No garbage collector. Stack and heap allocations are controlled with
new,release, anddefer. - Strong type system: Generics, traits, algebraic data types, and Hindley-Milner type inference.
- Powerful pattern matching: Exhaustive checks, guards, view patterns, and pattern synonyms.
- OOP when you need it: Classes with single inheritance, abstract classes, and virtual methods.
- Lazy evaluation on demand: Strict by default, with explicit
lazy { }blocks when needed.
Getting Started
Installation
Clone and build the compiler:
bash
git clone https://github.com/nicclang/nicc.git
cd nicc
cabal buildRunning Your First Program
Create a file called hello.nic:
nic
fn main() -> unit {
println("Hello, Nic!");
return;
}Compile and run:
bash
cabal run nicc -- --compile hello.nic
./helloOr just type-check without compiling:
bash
cabal run nicc -- --sast hello.nicHow to Use This Guide
Each page in this guide introduces a single concept with:
- Annotated code — Copy-paste ready examples
- Explanation — What each part does
- Running instructions — How to try it yourself
Work through the examples in order, or jump to any topic you're curious about.
Let's start with Hello World.