mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 00:44:27 +00:00
Vector types (SIMD): f32x8, i8x32, f64x4 and the rest; --cpu native
- fNxM / iNxM / uNxM up to 512 bits, as LLVM vectors (<8 x float>): LLVM picks SSE, AVX2, AVX-512 or NEON for them - f32x8(x) in every lane, f32x8(a, ..., h), f32x8(list, i) loads, f32x8(i32x8 v) converts - + - * / and the bit operators lane by lane, with a plain number on either side counting for every lane; v[i], v[i] = x, v.len, == / != (every lane), print and str - methods: sum min max dot abs sqrt floor ceil round fma store; min/max/abs/clamp lane by lane - wide vectors (and structs holding them) are loaded and stored with align 16, what malloc and the stack give - --cpu <name> (and cpu = "..." in finch.toml): native, x86-64-v3, apple-m1, ... - debug info shows vectors; the language server completes their methods; Kate and VS Code highlight them - f32 x = -1.5 works: a minus in front of a float written in the code keeps it such a number Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Psc42moPLwP43Cmb9oZqSR
This commit is contained in:
parent
a4bdeb5712
commit
68a9493572
21 changed files with 734 additions and 18 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## 2.6.0
|
||||
|
||||
- Vector types (`f32x8`, `i8x32`, `f64x4`, …) highlighted as types; completion of their methods (`sum`, `dot`, `fma`, `store`, …).
|
||||
|
||||
## 2.5.0
|
||||
|
||||
- Highlighting for code inside text (`"hp \(hp)"`), `test "…" { }` blocks, `const`, `"""` text, `1e9`.
|
||||
|
|
|
|||
4
editors/vscode/package-lock.json
generated
4
editors/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "finch-lang",
|
||||
"version": "2.4.0",
|
||||
"version": "2.6.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "finch-lang",
|
||||
"version": "2.4.0",
|
||||
"version": "2.6.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "^9.0.1"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "finch-lang",
|
||||
"displayName": "Finch",
|
||||
"description": "The Finch programming language: highlighting, errors as you type, completion, hover, go to definition, and a Run button.",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"publisher": "nexoniarz",
|
||||
"license": "Apache-2.0",
|
||||
"icon": "images/icon.png",
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
},
|
||||
{
|
||||
"name": "storage.type.primitive.finch",
|
||||
"match": "\\b(int|float|bool|char|str|ptr|map|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64)\\b"
|
||||
"match": "\\b(int|float|bool|char|str|ptr|map|i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|[iuf](?:8|16|32|64)x(?:2|4|8|16|32|64))\\b"
|
||||
},
|
||||
{
|
||||
"match": "\\b(print|input|read_file|write_file|file_exists|delete_file|shell|exit|addr|new|free|error|min|max|abs|clamp|assert|atomic_add|atomic_sub|atomic_load|atomic_store|atomic_swap|atomic_cas)\\s*(?=\\()",
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const code = [
|
|||
'test "lives \\(hp + f(1)) left" {',
|
||||
' assert(clamp(x, 0, 9) == 3)',
|
||||
'}',
|
||||
'fn dot(f32x8 a, i8x32 b) {',
|
||||
];
|
||||
const expect = [ // [line, token text, scope that must be present]
|
||||
[0, 'import', 'keyword.control.import'], [0, '"stdio.h"', 'string.quoted.double'],
|
||||
|
|
@ -49,6 +50,7 @@ const expect = [ // [line, token text, scope that must be present]
|
|||
[17, 'test', 'keyword.other.test'], [17, '\\(', 'punctuation.section.embedded.begin'], [17, 'hp', 'meta.embedded.line'],
|
||||
[17, 'f', 'meta.embedded.line'], [17, 'left', 'string.quoted.double'],
|
||||
[18, 'assert', 'support.function.builtin'], [18, 'clamp', 'support.function.builtin'],
|
||||
[20, 'f32x8', 'storage.type.primitive'], [20, 'i8x32', 'storage.type.primitive'],
|
||||
];
|
||||
registry.loadGrammar('source.finch').then((g) => {
|
||||
let state = vsctm.INITIAL, toks = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue