Cure Programming Language

v0.7.0

Dependently-typed programming language for the BEAM virtual machine with first-class finite state machines and SMT-backed verification.

Features

Why Cure

Quick Start

# Build the compiler
make all

# Compile an example
./cure examples/06_fsm_traffic_light.cure

# Run the compiled program
erl -pa _build/ebin -noshell -eval "'TrafficLightFSM':main(), init:stop()."

# Run tests
make test

Example Code

# Dependent types prove safety at compile time
def safe_head(v: Vector(T, n)): T when n > 0 =
  head(v)

# Native FSM syntax with verified transitions
fsm TrafficLight do
  Red --> |timer| Green
  Green --> |timer| Yellow  
  Yellow --> |timer| Red
  Green --> |emergency| Red
end

# Refinement types constrain values
def safe_divide(a: Int, b: {x: Int | x != 0}): Int =
  a / b

# Exhaustive pattern matching
def classify(x: Int): Atom =
  match x do
    n when n < 0 -> :negative
    0 -> :zero
    n when n > 0 -> :positive
  end

See More Examples