Rename the language from Dino to Rex

Files use .rex, the command is rex, and the crate, runtime prefixes,
docs, editor files and examples all use the new name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Your NameandClaude Opus 5.5 committed 2026-11-08 13:51:23 +01:00
1 parent 2f44f09b6a
commit 7cf9727bcd
94 files changed
+858 -858

No files matched your search

+22 -22
View File
@@ -4,13 +4,13 @@
use std::path::PathBuf;
use std::process::Command;
use dino::driver;
use rex::driver;
/// A fresh folder with the given files in it.
fn folder(files: &[(&str, &str)]) -> PathBuf {
static N: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
let n = N.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
let dir = std::env::temp_dir().join(format!("dino-clib-{}-{n}", std::process::id()));
let dir = std::env::temp_dir().join(format!("rex-clib-{}-{n}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
for (name, text) in files {
@@ -19,10 +19,10 @@ fn folder(files: &[(&str, &str)]) -> PathBuf {
dir
}
/// Compile `main.dino` in a folder with these files and run it; returns what it printed.
/// Compile `main.rex` in a folder with these files and run it; returns what it printed.
fn run(files: &[(&str, &str)]) -> String {
let dir = folder(files);
let c = driver::compile_file(dir.join("main.dino").to_str().unwrap()).unwrap_or_else(|e| panic!("{e}"));
let c = driver::compile_file(dir.join("main.rex").to_str().unwrap()).unwrap_or_else(|e| panic!("{e}"));
let exe = dir.join("prog");
let sanitized = driver::build_exe_with(&c, &exe, &["-std=c11", "-fwrapv", "-w", "-fsanitize=address", "-g"]);
if let Err(e) = sanitized {
@@ -40,7 +40,7 @@ fn run(files: &[(&str, &str)]) -> String {
/// The error message for a program that should not compile.
fn error(files: &[(&str, &str)]) -> String {
let dir = folder(files);
let r = driver::compile_file(dir.join("main.dino").to_str().unwrap());
let r = driver::compile_file(dir.join("main.rex").to_str().unwrap());
let _ = std::fs::remove_dir_all(&dir);
match r {
Ok(_) => panic!("expected an error"),
@@ -55,7 +55,7 @@ fn have_pkg(name: &str) -> bool {
#[test]
fn the_c_library() {
let out = run(&[(
"main.dino",
"main.rex",
"import \"math.h\" { cbrt, hypot }\nimport \"string.h\"\nimport \"stdlib.h\"\n\n\
func main() {\n print(cbrt(27.0), hypot(3.0, 4.0))\n print(string.strlen(\"héllo\"), stdlib.abs(-4))\n print(stdlib.atoi(\"42abc\") + 1)\n}\n",
)]);
@@ -149,7 +149,7 @@ shapes.Box{size: shapes.Size{w: 2.0, h: 3.0}, id: 5} 7\n0 10 11\n10\n[97, 98, 99
#[test]
fn your_own_c_file() {
let out = run(&[("shapes.h", SHAPES_H), ("shapes.c", SHAPES_C), ("main.dino", SHAPES_MAIN)]);
let out = run(&[("shapes.h", SHAPES_H), ("shapes.c", SHAPES_C), ("main.rex", SHAPES_MAIN)]);
assert_eq!(out, SHAPES_OUT);
}
@@ -178,7 +178,7 @@ const char *counter_name(const Counter *c) { return c->name.c_str(); }
void counter_free(Counter *c) { delete c; }
}
"#;
let out = run(&[("shapes.h", SHAPES_H), ("shapes.cpp", cpp), ("main.dino", SHAPES_MAIN)]);
let out = run(&[("shapes.h", SHAPES_H), ("shapes.cpp", cpp), ("main.rex", SHAPES_MAIN)]);
assert_eq!(out, SHAPES_OUT);
}
@@ -188,7 +188,7 @@ fn picked_names_are_used_bare() {
("shapes.h", SHAPES_H),
("shapes.c", SHAPES_C),
(
"main.dino",
"main.rex",
"import \"shapes.h\" { Size, area, MAX_SIDES }\n\nfunc main() {\n var s: Size = Size{1.5, 2.0}\n print(area(s), MAX_SIDES)\n}\n",
),
]);
@@ -201,7 +201,7 @@ fn zlib_through_pkg_config() {
return;
}
let out = run(&[(
"main.dino",
"main.rex",
r#"import "zlib.h"
func main() {
@@ -235,7 +235,7 @@ fn sqlite_fills_in_pointer_variables() {
return;
}
let out = run(&[(
"main.dino",
"main.rex",
r#"import "sqlite3.h"
func main() {
@@ -260,7 +260,7 @@ fn raylib_structs_without_a_window() {
return;
}
let out = run(&[(
"main.dino",
"main.rex",
"import \"raylib.h\"\n\nfunc main() {\n var c = raylib.Fade(raylib.RED, 0.5)\n print(c, raylib.ColorToInt(raylib.Color{0, 0, 0, 255}))\n var p = raylib.Vector2{1.0, 1.0}\n print(raylib.CheckCollisionPointRec(p, raylib.Rectangle{0.0, 0.0, 2.0, 2.0}))\n}\n",
)]);
assert_eq!(out, "raylib.Color{r: 230, g: 41, b: 55, a: 127} 255\ntrue\n");
@@ -268,32 +268,32 @@ fn raylib_structs_without_a_window() {
#[test]
fn errors_name_the_problem() {
let e = error(&[("main.dino", "import \"no_such_header.h\"\n\nfunc main() {}\n")]);
let e = error(&[("main.rex", "import \"no_such_header.h\"\n\nfunc main() {}\n")]);
assert!(e.contains("cannot find the C header `no_such_header.h`"), "{e}");
let e = error(&[("shapes.h", SHAPES_H), ("main.dino", "import \"shapes.h\" { aera }\n\nfunc main() {}\n")]);
let e = error(&[("shapes.h", SHAPES_H), ("main.rex", "import \"shapes.h\" { aera }\n\nfunc main() {}\n")]);
assert!(e.contains("`shapes.h` has no `aera` (did you mean `area`?)"), "{e}");
let e = error(&[("main.dino", "import \"stdio.h\"\n\nfunc main() {\n stdio.printf(\"hi\")\n}\n")]);
assert!(e.contains("`printf` can't be called from Dino: it takes a variable number of arguments"), "{e}");
let e = error(&[("main.rex", "import \"stdio.h\"\n\nfunc main() {\n stdio.printf(\"hi\")\n}\n")]);
assert!(e.contains("`printf` can't be called from Rex: it takes a variable number of arguments"), "{e}");
let e = error(&[("shapes.h", SHAPES_H), ("main.dino", "import \"shapes.h\"\n\nfunc main() {\n shapes.grow(shapes.Size{1.0, 1.0}, 2.0)\n}\n")]);
let e = error(&[("shapes.h", SHAPES_H), ("main.rex", "import \"shapes.h\"\n\nfunc main() {\n shapes.grow(shapes.Size{1.0, 1.0}, 2.0)\n}\n")]);
assert!(e.contains("`grow` writes into `s`, so it must be a variable"), "{e}");
let e = error(&[("shapes.h", SHAPES_H), ("main.dino", "import \"shapes.h\"\n\nfunc main() {\n var n = 3\n print(shapes.make_box(n))\n}\n")]);
let e = error(&[("shapes.h", SHAPES_H), ("main.rex", "import \"shapes.h\"\n\nfunc main() {\n var n = 3\n print(shapes.make_box(n))\n}\n")]);
assert!(e.contains("expected `i32`, found `int` (convert it with `i32(...)`)"), "{e}");
let e = error(&[("shapes.h", SHAPES_H), ("main.dino", "import \"shapes.h\"\n\nfunc main() {\n print(shapes.area())\n}\n")]);
let e = error(&[("shapes.h", SHAPES_H), ("main.rex", "import \"shapes.h\"\n\nfunc main() {\n print(shapes.area())\n}\n")]);
assert!(e.contains("`area` takes 1 argument (s: shapes.Size), but 0 were given"), "{e}");
}
#[test]
fn a_missing_library_says_how_to_link() {
let dir = folder(&[(
"main.dino",
"import \"math.h\" link \"dino_no_such_lib\"\n\nfunc main() {\n print(math.sqrt(4.0))\n}\n",
"main.rex",
"import \"math.h\" link \"rex_no_such_lib\"\n\nfunc main() {\n print(math.sqrt(4.0))\n}\n",
)]);
let c = driver::compile_file(dir.join("main.dino").to_str().unwrap()).unwrap();
let c = driver::compile_file(dir.join("main.rex").to_str().unwrap()).unwrap();
let e = driver::build_exe(&c, &dir.join("prog")).unwrap_err();
let _ = std::fs::remove_dir_all(&dir);
assert!(e.contains("linking with the C library failed") && e.contains("link \"name\""), "{e}");