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:
1 parent
5b42e2a3bd
commit
2f44f09b6a
26 files changed
+3418
-70
No files matched your search
@@ -63,6 +63,8 @@ error: age cannot be negative
|
||||
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.
|
||||
|
||||
@@ -96,17 +98,18 @@ dino run hello.dino
|
||||
| `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/`](docs/README.md) 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, and a full cheatsheet. Every example in it is run by
|
||||
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.
|
||||
|
||||
The last chapter builds a calculator over five files. It lives in
|
||||
Chapter 12 builds a calculator over five files. It lives in
|
||||
[`examples/calc`](examples/calc), next to many smaller programs in
|
||||
[`examples/basics`](examples/basics).
|
||||
[`examples/basics`](examples/basics). [`examples/c`](examples/c) has a small raylib game.
|
||||
|
||||
For the exact rules of the language, see [`SPEC.md`](SPEC.md).
|
||||
|
||||
|
||||
Reference in new issue
Block a user