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>
This commit is contained in:
Your NameandClaude Opus 5.5 committed 2026-11-08 12:55:41 +01:00
1 parent 5b42e2a3bd
commit 2f44f09b6a
26 files changed
+3418 -70

No files matched your search

+10 -1
View File
@@ -119,8 +119,17 @@ import os // built-in: os math time
pub func f() {} // visible to other files
```
## C libraries
```dino
import "zlib.h" // zlib.crc32(...), zlib.Z_OK, types like zlib.gzFile
import "raylib.h" { InitWindow } // only these names, used bare
import "foo.h" link "foo" // when pkg-config doesn't know it (libfoo.so)
var f = stdio.fopen("x.txt", "r") // C pointers: compare with nil, close them yourself
lib.fill(buf, n) // T* parameters take a variable or a list
```
## Commands
`dino run f.dino args…` · `dino build f.dino -o out` · `dino check f.dino` · `dino emit-c f.dino` · `dino fmt path` (`--check` to only report) · `dino lsp` (editor server)
`dino run f.dino args…` · `dino build f.dino -o out` · `dino check f.dino` · `dino emit-c f.dino` · `dino fmt path` (`--check` to only report) · `dino lsp` (editor server) · `dino header x.h [word]` (what a C header offers)
## Things that stop the program (exit code 2)
Divide by zero · list index/slice out of range · `pop` on an empty list · reading a missing