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:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Dino language spec (draft)
|
||||
# Rex language spec (draft)
|
||||
|
||||
Goal: Go-like simplicity, C++/Rust speed, no GC, no low-level syntax.
|
||||
Targets: game dev, CLI tools, desktop apps.
|
||||
@@ -160,8 +160,8 @@ Targets: game dev, CLI tools, desktop apps.
|
||||
passing lists around costs nothing. Every test program runs under the address
|
||||
sanitizer, so a leak, double free or use after free fails the test.
|
||||
|
||||
- **Imports**: `import os` (built-in) or `import utils` (the file `utils.dino` next to the
|
||||
main file; `import tools.fs` is `tools/fs.dino`, used as `fs.name`). Use things as
|
||||
- **Imports**: `import os` (built-in) or `import utils` (the file `utils.rex` next to the
|
||||
main file; `import tools.fs` is `tools/fs.rex`, used as `fs.name`). Use things as
|
||||
`utils.double(2)`, `utils.Vec2{1.0, 2.0}`, `utils.Shape.Circle(1.0)`, `utils.SCALE`,
|
||||
and `utils.Vec2` in types. Only `pub` functions, consts, types, methods and fields can be used
|
||||
from another file (fields are private too unless written `pub x: int`). Each file has its own imports and its
|
||||
@@ -185,12 +185,12 @@ Targets: game dev, CLI tools, desktop apps.
|
||||
invalid UTF-8 comes out as U+FFFD). `s[i]` is the character starting at byte `i` (panics out of range or
|
||||
in the middle of a character); strings can't be assigned to. Methods `is_digit is_letter is_alnum is_space
|
||||
is_upper is_lower upper lower` (ASCII plus Latin-1 letters). `s.chars()` gives a `[]char`. Not yet: `[]char`→string.
|
||||
- **Formatter** `dino fmt [--check] <file|folder>..` (`src/fmt.rs`): text based, so comments and blank lines survive.
|
||||
- **Formatter** `rex fmt [--check] <file|folder>..` (`src/fmt.rs`): text based, so comments and blank lines survive.
|
||||
4-space indent, spaces around binary operators and after `,` `:`, tight `Point{...}` / map literals and `[]T`,
|
||||
at most one blank line, trailing `//` comments of neighbouring lines aligned. It never moves line breaks (a one-line
|
||||
block stays one line), indents continuation lines (after an operator, or inside open brackets) one level, and
|
||||
verifies that the token stream is unchanged before writing. `examples/` must stay formatted (a test checks).
|
||||
- **Editor support** (`editors/`): `dino lsp` is a language server (`src/lsp.rs`, own JSON in `src/json.rs`, no
|
||||
- **Editor support** (`editors/`): `rex lsp` is a language server (`src/lsp.rs`, own JSON in `src/json.rs`, no
|
||||
dependencies): full-text sync, error diagnostics from the real checker (imports read from disk or from open
|
||||
buffers; errors in other files shown at the top of the importing file; UTF-16 columns), whole-file formatting.
|
||||
`editors/vscode` (extension + TextMate grammar), `editors/vim` (syntax), `editors/README.md` (Neovim, Helix, others).
|
||||
@@ -204,16 +204,16 @@ Targets: game dev, CLI tools, desktop apps.
|
||||
guessed from the header path, else `import "x.h" link "x"` (`-lx`). A header next to the program adds `-I` and
|
||||
builds the `.c`/`.cpp`/`.cc` file with the same name into the program (C++ with `c++`, linked with `-lstdc++`).
|
||||
Types: C ints -> sized numbers (`int` i32, `long` int, `size_t` u64), `double` float, `char` i8 (takes `'a'`),
|
||||
`char *` -> string (copied both ways, NULL -> ""), enums -> `i32` constants, plain structs -> Dino structs with the
|
||||
`char *` -> string (copied both ways, NULL -> ""), enums -> `i32` constants, plain structs -> Rex structs with the
|
||||
C field names (`raylib.Color`; converted field by field at calls), other pointers -> pointer types
|
||||
(`Ty::CPtr`, `stdio.FILE`, `nil` = NULL, `==` compares); `void *` (`pointer`) mixes with every pointer type.
|
||||
`T *` parameters take a variable (the address is passed; counts as a change for inferred mutation) or a list
|
||||
(its items); `const T *` also takes any value. Constants: numbers, strings, and struct literals like
|
||||
`CLITERAL(Color){...}` (emitted as the macro). Programs that import headers are built with `-std=gnu11`.
|
||||
Not supported (a clear error when called): variadic functions, callbacks, unions/arrays by value, lists of
|
||||
structs, `long double`, function-like macros. Dino never frees C memory. `dino header x.h [word]` lists what Dino sees.
|
||||
structs, `long double`, function-like macros. Rex never frees C memory. `rex header x.h [word]` lists what Rex sees.
|
||||
- **String slicing**: `s[a..b]`, `s[a..]`, `s[..b]` (byte positions, bounds checked; panics with "the length is N").
|
||||
- **Running**: `dino run file.dino a b c` passes `a b c` to the program (`os.args`).
|
||||
- **Running**: `rex run file.rex a b c` passes `a b c` to the program (`os.args`).
|
||||
- **Example**: `examples/calc/` is a multi-file calculator (tokenizer, parser, evaluator, shared scope); `session.txt` / `session.out` are checked by a test.
|
||||
|
||||
## Open questions
|
||||
@@ -225,6 +225,6 @@ Working: functions, int/float/bool/string, var/const, if/else, for (infinite,
|
||||
while, range with step, over lists), break/continue, string interpolation, print,
|
||||
structs with methods (value semantics, inferred mutation), lists (value
|
||||
semantics, bounds checked), enums with data + exhaustive match, errors (`error`,
|
||||
multi-value returns, `?`), optionals (`T?`, `nil`, narrowing), `dino run`.
|
||||
multi-value returns, `?`), optionals (`T?`, `nil`, narrowing), `rex run`.
|
||||
Not yet: nested match patterns, `==` on lists/structs, top-level const lists. These give a clear "not supported yet" error.
|
||||
Known gaps: memory is only freed on normal exits (a panic just ends the program).
|
||||
Reference in new issue
Block a user