Skip to content

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, and defer.
  • 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 build

Running 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
./hello

Or just type-check without compiling:

bash
cabal run nicc -- --sast hello.nic

How to Use This Guide

Each page in this guide introduces a single concept with:

  1. Annotated code — Copy-paste ready examples
  2. Explanation — What each part does
  3. 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.

Released under the MIT License.