Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6cc3b23
feat: replace numeric subtyping with explicit modes 🔢
timfennis Aug 27, 2026
100a554
fix: highlight advanced number literals everywhere 🎨
timfennis Aug 27, 2026
2126915
refactor(lexer): reject bare bigint literals 🚫
timfennis Aug 27, 2026
15122be
fix(stdlib): restore transcendental function docs 📚
timfennis Aug 27, 2026
33a4f21
refactor(core): store Number integers as BigInt 🧹
timfennis Aug 27, 2026
662385d
perf(vm): compare primitive numerics directly ⚡
timfennis Aug 27, 2026
62d982f
perf(stdlib): prioritize homogeneous numeric overloads 🏎️
timfennis Aug 27, 2026
c99f512
perf(stdlib): fold borrowed numeric collections 🧮
timfennis Aug 27, 2026
fc59d75
fix(bench): use Number for bigint benchmark 🔢
timfennis Aug 27, 2026
43a40c0
fix(stdlib): add explicit numeric overloads for randf and randi 🎲
timfennis Aug 27, 2026
d7e4713
test(lsp): adapt completion grouping to sibling numeric types 🧪
timfennis Sep 1, 2026
322b50e
test: cast into typed collections for numeric dispatch 🎯
timfennis Sep 2, 2026
d553248
docs(manual): explain typed-collection dispatch and its cast 📚
timfennis Sep 2, 2026
924b3f5
refactor: centralize numeric runtime handling 🔢
timfennis Sep 2, 2026
29e5650
refactor(lexer): unify numeric literal handling 🔢
timfennis Sep 3, 2026
b190841
Fix some performance degradation
timfennis Sep 3, 2026
847d1bd
perf(stdlib): read numeric operands straight from their slots ⚡
timfennis Sep 3, 2026
123232b
chore: cleanup num code
timfennis Sep 3, 2026
c4fc393
chore: move number from core to vm
timfennis Sep 3, 2026
888b9a0
chore: improve documentation
timfennis Sep 3, 2026
16ad243
fix(stdlib): keep i64::MIN remainders in range 🔢
timfennis Sep 5, 2026
e1486ce
fix(vm): accept Number floats from comparators ⚖️
timfennis Sep 5, 2026
b563cf4
fix(macros): match the Number these params declare 🎭
timfennis Sep 5, 2026
1d29e7f
refactor(stdlib): give randi Int bounds only 🎲
timfennis Sep 5, 2026
9b2e87a
fix(vm): repair exact-number results and hashing 🔢
timfennis Sep 5, 2026
fa503ca
fix(stdlib): report left shifts that overflow their Int result ⬅️
timfennis Sep 5, 2026
9578fd0
fix(vm): say what is actually wrong with a rejected value 📏
timfennis Sep 5, 2026
e801fc1
refactor(vm): drop a redundant range check 🧹
timfennis Sep 5, 2026
2a6a1af
docs(manual): spell out Number's zero-divisor result 📝
timfennis Sep 5, 2026
46b2e3e
fix(vm): normalize every exact fraction, not just the ones from divis…
timfennis Sep 7, 2026
10751c1
refactor(vm): make a whole fraction unrepresentable 🔒
timfennis Sep 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ndc_macros = { path = "ndc_macros", version = "0.1.0" }
ndc_stdlib = { path = "ndc_stdlib", version = "0.3.0" }
num = "0.4.3"
once_cell = "1.21.4"
ordered-float = "5.3.0"
proptest = "1.11"
yansi = { version = "1.0.1", features = ["detect-tty", "detect-env"] }
rand = "0.10.2"
Expand Down
2 changes: 1 addition & 1 deletion benches/programs/bigint.ndc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let result = 1;
let result = 1n;
for i in 2..=5000 {
result *= i;
}
Expand Down
2 changes: 1 addition & 1 deletion benches/programs/closures.ndc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let total = 0;
for _ in 0..20 {
let adders = [fn(x) => x + i for i in 0..10_000];
total = total + adders.map(fn(f) => f(0)).sum;
total = total + (adders.map(fn(f) => f(0)) as List<Int>).sum;
};
print(total);
4 changes: 2 additions & 2 deletions benches/programs/perlin.ndc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn fade(t) => t * t * t * (t * (t * 6 - 15) + 10);

fn lerp(a, b, t) => a + t * (b - a);

fn gradient(h, x, y) => (vectors[h % 8] * (x, y)).sum
fn gradient(h, x, y) => ((vectors[h % 8] * (x, y)) as Tuple<Float, Float>).sum

fn perlin(x, y, perm) {
let xi, yi = int(x) & 255, int(y) & 255;
Expand Down Expand Up @@ -33,4 +33,4 @@ fn benchmark_perlin(grid_size) {
}

let noise = benchmark_perlin(100);
print("Min:", noise.min, "Max:", noise.max, "Avg:", (noise.sum / noise.len));
print("Min:", noise.min, "Max:", noise.max, "Avg:", ((noise as List<Float>).sum / noise.len));
24 changes: 12 additions & 12 deletions ext/andy-cpp/syntaxes/andy-cpp.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{
"comment": "built-in type names used in annotations like `let x: Int` or `-> List<Int>`",
"name": "support.type.andy-cpp",
"match": "\\b(Any|Never|Bool|Number|Float|Int|Rational|Complex|String|Option|Sequence|List|Iterator|MinHeap|MaxHeap|Deque|Tuple|Map)\\b"
"match": "\\b(Any|Never|Bool|Number|Float|Int|String|Option|Sequence|List|Iterator|MinHeap|MaxHeap|Deque|Tuple|Map)\\b"
}
]
},
Expand Down Expand Up @@ -200,18 +200,18 @@
"name": "constant.numeric.complex.andy-cpp"
},
{
"comment": "Floats",
"match": "\\b([0-9][0-9_]*\\.[0-9][0-9_]*)\\b",
"comment": "Primitive Float and advanced Number float literals",
"match": "\\b([0-9][0-9_]*\\.[0-9][0-9_]*n?)\\b",
"name": "constant.numeric.float.andy-cpp"
},
{
"comment": "Hexadecimal numbers",
"match": "\\b(0x[0-9A-Fa-f][0-9A-Fa-f_]*)\\b",
"comment": "Primitive Int and advanced Number hexadecimal literals",
"match": "\\b(0x[0-9A-Fa-f][0-9A-Fa-f_]*n?)\\b",
"name": "constant.numeric.hex.andy-cpp"
},
{
"comment": "Ocatal n umbers",
"match": "\\b(0o[0-7][0-7]*)\\b",
"comment": "Primitive Int and advanced Number octal literals",
"match": "\\b(0o[0-7][0-7_]*n?)\\b",
"name": "constant.numeric.octal.andy-cpp"
},
{
Expand All @@ -220,13 +220,13 @@
"name": "constant.numeric.andy-cpp"
},
{
"comment": "Binary numbers",
"match": "\\b(0b[01][01_]*)\\b",
"comment": "Primitive Int and advanced Number binary literals",
"match": "\\b(0b[01][01_]*n?)\\b",
"name": "constant.numeric.binary.andy-cpp"
},
{
"comment": "Integer numbers",
"match": "\\b([0-9][0-9_]*)\\b",
"comment": "Primitive Int and advanced Number decimal literals",
"match": "\\b([0-9][0-9_]*n?)\\b",
"name": "constant.numeric.decimal.andy-cpp"
},
{
Expand Down Expand Up @@ -492,4 +492,4 @@
}
},
"scopeName": "source.andy-cpp"
}
}
10 changes: 5 additions & 5 deletions ext/tree-sitter-andy-cpp/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,14 @@ module.exports = grammar({
),

integer: _ => token(choice(
/0b[01][01_]*/,
/0o[0-7][0-7_]*/,
/0x[0-9A-Fa-f][0-9A-Fa-f_]*/,
/0b[01][01_]*n?/,
/0o[0-7][0-7_]*n?/,
/0x[0-9A-Fa-f][0-9A-Fa-f_]*n?/,
/[0-9]+r[0-9A-Za-z][0-9A-Za-z_]*/, // arbitrary radix, e.g. 16rFF
/[0-9][0-9_]*/,
/[0-9][0-9_]*n?/,
)),

float: _ => token(/[0-9][0-9_]*\.[0-9][0-9_]*/),
float: _ => token(/[0-9][0-9_]*\.[0-9][0-9_]*n?/),

// Imaginary part of a complex literal: `3i`, `2.5j`
complex: _ => token(/[0-9][0-9_]*(\.[0-9][0-9_]*)?[ij]/),
Expand Down
10 changes: 5 additions & 5 deletions ext/tree-sitter-andy-cpp/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2705,23 +2705,23 @@
"members": [
{
"type": "PATTERN",
"value": "0b[01][01_]*"
"value": "0b[01][01_]*n?"
},
{
"type": "PATTERN",
"value": "0o[0-7][0-7_]*"
"value": "0o[0-7][0-7_]*n?"
},
{
"type": "PATTERN",
"value": "0x[0-9A-Fa-f][0-9A-Fa-f_]*"
"value": "0x[0-9A-Fa-f][0-9A-Fa-f_]*n?"
},
{
"type": "PATTERN",
"value": "[0-9]+r[0-9A-Za-z][0-9A-Za-z_]*"
},
{
"type": "PATTERN",
"value": "[0-9][0-9_]*"
"value": "[0-9][0-9_]*n?"
}
]
}
Expand All @@ -2730,7 +2730,7 @@
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[0-9][0-9_]*\\.[0-9][0-9_]*"
"value": "[0-9][0-9_]*\\.[0-9][0-9_]*n?"
}
},
"complex": {
Expand Down
Loading
Loading