Your NameandClaude Opus 5.5 2f44f09b6a Add C and C++ library support
import "zlib.h" reads the header (cc -E + a small C declaration
parser), links via pkg-config or link "name", and builds .c/.cpp
files next to the program. C structs become Dino structs, pointers
become pointer types (nil = NULL), T* parameters take variables or
lists. Adds dino header, editor completion/hover for C names,
docs chapter 13, a raylib example, and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00
2026-11-08 12:55:41 +01:00

Dino, the mascot

Dino

A small, fast language. It looks like Go, runs like C, and you never write anything low-level.


Dino compiles to C and then to a native program. There is no garbage collector, no pointers and no manual memory: you write plain code and the compiler works out the rest.

enum Shape {
    Circle(r: float)
    Rect(w, h: float)
}

func area(s: Shape): float {
    return match s {
        Circle(r) => 3.14 * r * r
        Rect(w, h) => w * h
    }
}

func parse_age(text: string): (int, error) {
    var n, err = text.to_int()
    if err != nil { return 0, err }
    if n < 0 { return 0, error("age cannot be negative") }
    return n, nil
}

func main() {
    var shapes = [Shape.Circle(1.0), Shape.Rect(2.0, 3.0)]
    for s in shapes { print(area(s)) }

    var counts: map[string, int] = {}
    for word in "the cat and the hat".split(" ") { counts[word] += 1 }
    print(counts)

    var age, err = parse_age("-4")
    if err != nil { print("error:", err) }
}
3.14
6.0
{the: 2, cat: 1, and: 1, hat: 1}
error: age cannot be negative

Why Dino

  • Simple syntax. var, func, for, match. One loop keyword, no semicolons, no parentheses around conditions. Types are inferred.
  • Fast. Your code becomes C and is built by cc, so it runs at native speed.
  • Safe memory without the work. Values are copied, not shared by accident. Mutation is worked out for you. shared and weak exist for the few times you need a graph or a cache.
  • Errors you can see. A function that can fail returns (T, error). A value that may be missing is T?. Both must be handled.
  • Modern basics. Enums that carry data, exhaustive match, generics, interfaces, closures, maps, characters, modules.
  • C and C++ libraries. import "raylib.h" and call it: Dino reads the header itself, links the library, and builds your own .c/.cpp files next to the program.
  • Tooling included. A formatter, a language server, and editor files, all in the one dino program.

Get started

You need a Rust toolchain to build the compiler and a C compiler (gcc or clang, available as cc) to build your programs. Dino itself has no dependencies.

cargo build --release
cp target/release/dino ~/.local/bin/      # or anywhere on your PATH

Save this as hello.dino:

func main() {
    print("Hello, Dino!")
}
dino run hello.dino
Command What it does
dino run file.dino [args...] Compile and run. Extra words reach the program as os.args.
dino build file.dino -o out Make an executable you can keep.
dino check file.dino Look for errors without building.
dino emit-c file.dino Print the generated C.
dino fmt [--check] path... Format code (--check only reports).
dino lsp Start the language server (editors run this for you).
dino header file.h [word] Show what Dino can use from a C header.

Learn the language

The docs/ folder is a short course, written to be read in order: first steps, values, control flow, functions, lists and maps, structs and enums, errors, memory, generics and interfaces, modules, C and C++ libraries, and a full cheatsheet. Every example in it is run by the test suite, so what you read is what happens.

Chapter 12 builds a calculator over five files. It lives in examples/calc, next to many smaller programs in examples/basics. examples/c has a small raylib game.

For the exact rules of the language, see SPEC.md.

Editors

Syntax colours for VS Code and Vim/Neovim live in editors/. The language server gives you error underlines as you type, format on save, an outline, go to definition, hover, completion and parameter hints in any editor that speaks LSP.

Project layout

Path What is there
src/ The compiler: lexer, parser, checker, C generator, formatter, language server
tests/ The test suite (programs are compiled and run with leak checking)
docs/ The course
examples/ Programs to read and run
editors/ VS Code and Vim files, and setup notes

Run the tests with cargo test.

S
Description
No description provided
Readme
1.3 MiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 96.8%
C 2.9%
Vim Script 0.2%