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
@@ -4,7 +4,7 @@ The folder `examples/calc/` holds a calculator split over five files. It uses al
|
||||
everything from these notes. Run it:
|
||||
|
||||
```text
|
||||
cargo run -q -- run examples/calc/main.dino examples/calc/session.txt
|
||||
cargo run -q -- run examples/calc/main.rex examples/calc/session.txt
|
||||
```
|
||||
|
||||
or type calculations interactively by leaving off the file name.
|
||||
@@ -21,11 +21,11 @@ sqrt(16) + max(1, 5)
|
||||
|
||||
| File | Job | Features it shows |
|
||||
|------|-----|-------------------|
|
||||
| `token.dino` | Turns text into tokens | enums, structs, `char`, string slicing, errors |
|
||||
| `ast.dino` | The shape of a calculation | an enum that holds other nodes |
|
||||
| `parser.dino` | Builds the tree | a struct with methods, `?`, recursion |
|
||||
| `eval.dino` | Computes the answer | `match`, maps, function values, closures |
|
||||
| `main.dino` | Reads lines and prints | `import`, `os`, `shared` |
|
||||
| `token.rex` | Turns text into tokens | enums, structs, `char`, string slicing, errors |
|
||||
| `ast.rex` | The shape of a calculation | an enum that holds other nodes |
|
||||
| `parser.rex` | Builds the tree | a struct with methods, `?`, recursion |
|
||||
| `eval.rex` | Computes the answer | `match`, maps, function values, closures |
|
||||
| `main.rex` | Reads lines and prints | `import`, `os`, `shared` |
|
||||
|
||||
## 1. Tokens
|
||||
|
||||
@@ -39,7 +39,7 @@ kind of token starts there: `c.is_digit()` starts a number, `c.is_letter()` a na
|
||||
|
||||
## 2. The tree
|
||||
|
||||
```dino
|
||||
```rex
|
||||
pub enum Node {
|
||||
Num(value: float)
|
||||
Var(name: string)
|
||||
@@ -63,7 +63,7 @@ with `?`.
|
||||
|
||||
The scope that remembers variables and functions is two maps:
|
||||
|
||||
```dino
|
||||
```rex
|
||||
pub struct Scope {
|
||||
variables: map[string, float]
|
||||
builtins: map[string, Builtin]
|
||||
@@ -74,7 +74,7 @@ pub struct Scope {
|
||||
A built-in function is a struct holding its name, how many arguments it takes, and a
|
||||
function value:
|
||||
|
||||
```dino
|
||||
```rex
|
||||
s.builtins["sqrt"] = Builtin{"sqrt", 1, a => math.sqrt(a[0])}
|
||||
```
|
||||
|
||||
@@ -86,7 +86,7 @@ which gives `nil` when it isn't there, turned into a friendly error.
|
||||
The scope is created once as `shared`, so every line sees the variables set by the
|
||||
lines before it, with no need to pass the scope back and forth:
|
||||
|
||||
```dino
|
||||
```rex
|
||||
var scope = shared eval.new_scope()
|
||||
...
|
||||
run_line(scope, line)
|
||||
|
||||
Reference in new issue
Block a user