From 7d62baf88409b437860bb704f480fcedef00d486 Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 17 Mar 2026 21:03:37 +0530 Subject: [PATCH 1/3] feat(vscode): add rey syntax highlighting extension --- rey-vscode/README.md | 22 +++++ rey-vscode/language-configuration.json | 22 +++++ rey-vscode/package.json | 34 +++++++ rey-vscode/syntaxes/rey.tmLanguage.json | 113 ++++++++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 rey-vscode/README.md create mode 100644 rey-vscode/language-configuration.json create mode 100644 rey-vscode/package.json create mode 100644 rey-vscode/syntaxes/rey.tmLanguage.json diff --git a/rey-vscode/README.md b/rey-vscode/README.md new file mode 100644 index 0000000..ebfe165 --- /dev/null +++ b/rey-vscode/README.md @@ -0,0 +1,22 @@ +# Rey — VSCode extension + +Syntax highlighting for the Rey programming language (`.rey`). + +## Features +- Keywords, types, and builtins highlighting +- Strings, numbers, booleans, and `//` comments +- Function declarations and calls + +## Install locally (development) +1. Open the `rey-vscode/` folder in VSCode. +2. Press `F5` to launch an Extension Development Host. +3. Open a `.rey` file in the dev host and verify highlighting. + +## Install locally (VSIX) +1. Package the extension: + - `npx @vscode/vsce package` +2. Install the produced `.vsix`: + - `code --install-extension rey-lang-0.0.1.vsix` + +## Install from Marketplace +When published, search for `Rey` or `rey-lang` by `rey-language` in the VSCode Extensions view. diff --git a/rey-vscode/language-configuration.json b/rey-vscode/language-configuration.json new file mode 100644 index 0000000..670476a --- /dev/null +++ b/rey-vscode/language-configuration.json @@ -0,0 +1,22 @@ +{ + "comments": { + "lineComment": "//" + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"", "notIn": ["string", "comment"] } + ], + "surroundingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"" } + ] +} diff --git a/rey-vscode/package.json b/rey-vscode/package.json new file mode 100644 index 0000000..5f506d1 --- /dev/null +++ b/rey-vscode/package.json @@ -0,0 +1,34 @@ +{ + "name": "rey-lang", + "displayName": "Rey", + "description": "Syntax highlighting for the Rey programming language (.rey).", + "version": "0.0.1", + "publisher": "rey-language", + "license": "MIT", + "engines": { + "vscode": "^1.90.0" + }, + "categories": [ + "Programming Languages" + ], + "activationEvents": [ + "onLanguage:rey" + ], + "contributes": { + "languages": [ + { + "id": "rey", + "aliases": ["Rey", "rey"], + "extensions": [".rey"], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "rey", + "scopeName": "source.rey", + "path": "./syntaxes/rey.tmLanguage.json" + } + ] + } +} diff --git a/rey-vscode/syntaxes/rey.tmLanguage.json b/rey-vscode/syntaxes/rey.tmLanguage.json new file mode 100644 index 0000000..c6ec19d --- /dev/null +++ b/rey-vscode/syntaxes/rey.tmLanguage.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Rey", + "scopeName": "source.rey", + "patterns": [ + { "include": "#comments" }, + { "include": "#strings" }, + { "include": "#numbers" }, + { "include": "#booleans" }, + { "include": "#null" }, + { "include": "#keywords" }, + { "include": "#types" }, + { "include": "#builtins" }, + { "include": "#functionDecl" }, + { "include": "#functionCall" } + ], + "repository": { + "comments": { + "patterns": [ + { + "name": "comment.line.double-slash.rey", + "match": "//.*$" + } + ] + }, + "strings": { + "patterns": [ + { + "name": "string.quoted.double.rey", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.rey", + "match": "\\\\." + } + ] + } + ] + }, + "numbers": { + "patterns": [ + { + "name": "constant.numeric.rey", + "match": "\\b\\d+(?:\\.\\d+)?\\b" + } + ] + }, + "booleans": { + "patterns": [ + { + "name": "constant.language.boolean.rey", + "match": "\\b(?:true|false)\\b" + } + ] + }, + "null": { + "patterns": [ + { + "name": "constant.language.null.rey", + "match": "\\bnull\\b" + } + ] + }, + "keywords": { + "patterns": [ + { + "name": "keyword.control.rey", + "match": "\\b(?:func|var|return|if|else|while|for|in|break|continue)\\b" + } + ] + }, + "types": { + "patterns": [ + { + "name": "storage.type.rey", + "match": "\\b(?:int|float|String|bool|Void|null)\\b" + } + ] + }, + "builtins": { + "patterns": [ + { + "name": "support.function.builtin.rey", + "match": "\\b(?:println|len|push|pop|input|range)\\b(?=\\s*\\()" + } + ] + }, + "functionDecl": { + "patterns": [ + { + "name": "meta.function.declaration.rey", + "match": "\\bfunc\\s+([A-Za-z_][A-Za-z0-9_]*)\\b", + "captures": { + "0": { "name": "keyword.control.rey" }, + "1": { "name": "entity.name.function.rey" } + } + } + ] + }, + "functionCall": { + "patterns": [ + { + "name": "meta.function-call.rey", + "match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\b(?=\\s*\\()", + "captures": { + "1": { "name": "entity.name.function.rey" } + } + } + ] + } + } +} From e9db9fe84f3c80bed9fe4ce8401d27682a3dc57d Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 17 Mar 2026 21:07:17 +0530 Subject: [PATCH 2/3] chore(linguist): add rey language submission prep --- CHANGELOG.md | 3 +++ LINGUIST.md | 39 +++++++++++++++++++++++++++++++++++++++ languages/Rey.yaml | 7 +++++++ languages/samples/Rey.rey | 37 +++++++++++++++++++++++++++++++++++++ primer.md | 3 +++ 5 files changed, 89 insertions(+) create mode 100644 LINGUIST.md create mode 100644 languages/Rey.yaml create mode 100644 languages/samples/Rey.rey diff --git a/CHANGELOG.md b/CHANGELOG.md index 7622e26..9c83ca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [tooling] — 2026-03-17 +- Added Linguist submission prep files: `languages/Rey.yaml`, `languages/samples/Rey.rey`, `LINGUIST.md` + ## [fix] — 2026-03-17 - Added array methods: `.length()` and `.push()` - Allowed typed empty array assignment like `var xs: [int] = []` diff --git a/LINGUIST.md b/LINGUIST.md new file mode 100644 index 0000000..c860387 --- /dev/null +++ b/LINGUIST.md @@ -0,0 +1,39 @@ +# Rey — GitHub Linguist submission prep + +This repo contains **Rey**, an experimental programming language and interpreter written in Rust. + +This directory layout is intended to prepare a future PR to `github-linguist/linguist` so GitHub can recognize `.rey` files as the **Rey** language (syntax highlighting on GitHub, language stats, etc.). + +## Repo links +- Rey language repo: https://github.com/rey-language/rey +- GitHub Linguist: https://github.com/github-linguist/linguist + +## Proposed Linguist metadata +- `.gitattributes` marks `*.rey` as `linguist-language=Rey` +- `languages/Rey.yaml` contains the language definition (format mirrors Linguist language YAML entries) +- `languages/samples/Rey.rey` is a clean consolidated sample for tests/highlighting + +## Sample sources +The sample is consolidated from existing test fixtures: +- `compiler/v1/src/tests/arrays.rey` +- `compiler/v1/src/tests/array_methods.rey` +- `compiler/v1/src/tests/functions.rey` +- `compiler/v1/src/tests/property_access.rey` +- `compiler/v1/src/tests/full_demo.rey` + +## Sample code +```rey +// see languages/samples/Rey.rey for the full sample +func main(): Void { + var xs: [int] = []; + xs.push(1); + println(xs.length()); +} +``` + +## How this maps to a future Linguist PR +In `github-linguist/linguist`, this would translate to: +- Adding `.rey` + metadata to Linguist’s language definitions +- Adding `languages/samples/Rey.rey` (or equivalent) as the sample used for detection/highlighting tests + +This repo keeps the metadata and sample here to make the upstream PR straightforward. diff --git a/languages/Rey.yaml b/languages/Rey.yaml new file mode 100644 index 0000000..dd2cec0 --- /dev/null +++ b/languages/Rey.yaml @@ -0,0 +1,7 @@ +name: Rey +type: programming +color: "#eb4c3b" +extensions: + - ".rey" +tm_scope: source.rey +ace_mode: text diff --git a/languages/samples/Rey.rey b/languages/samples/Rey.rey new file mode 100644 index 0000000..4343803 --- /dev/null +++ b/languages/samples/Rey.rey @@ -0,0 +1,37 @@ +// Rey sample for GitHub Linguist + +func add(a: int, b: int): int { + return a + b; +} + +func main(): Void { + // typed empty array + methods + builtins + var xs: [int] = []; + xs.push(1); + xs.push(2); + println(xs.length()); + println(len(xs)); + + // dictionaries + property access + var user = {name: "Rey", id: 42}; + if (user.id > 10) { + println("ok"); + } else { + println("no"); + } + + // loops + range + break/continue + var sum: int = 0; + for i in range(1, 10) { + if (i == 3) { continue; } + if (i == 6) { break; } + sum = sum + i; + } + println(sum); + + while (sum > 0) { + sum = sum - 1; + } + + println(add(2, 3)); +} diff --git a/primer.md b/primer.md index 805a737..55e32bd 100644 --- a/primer.md +++ b/primer.md @@ -52,3 +52,6 @@ Run any of them with cargo run -- src/tests/.rey ## For next session - Consider tightening the language spec (what is int vs float at runtime, truthiness rules, dictionary key restrictions). - Add negative tests for type errors once there's a harness for expected-failure cases. +- Submit upstream PRs: + - `github-linguist/linguist` for Rey language recognition + - VSCode Marketplace publish for `rey-vscode/` (optional) From 88d8e671d12fa51800e00faef3718f6367cfa9cf Mon Sep 17 00:00:00 2001 From: codex Date: Tue, 17 Mar 2026 21:14:38 +0530 Subject: [PATCH 3/3] chore: remove rey-vscode from index --- rey-vscode/README.md | 22 ----- rey-vscode/language-configuration.json | 22 ----- rey-vscode/package.json | 34 ------- rey-vscode/syntaxes/rey.tmLanguage.json | 113 ------------------------ 4 files changed, 191 deletions(-) delete mode 100644 rey-vscode/README.md delete mode 100644 rey-vscode/language-configuration.json delete mode 100644 rey-vscode/package.json delete mode 100644 rey-vscode/syntaxes/rey.tmLanguage.json diff --git a/rey-vscode/README.md b/rey-vscode/README.md deleted file mode 100644 index ebfe165..0000000 --- a/rey-vscode/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Rey — VSCode extension - -Syntax highlighting for the Rey programming language (`.rey`). - -## Features -- Keywords, types, and builtins highlighting -- Strings, numbers, booleans, and `//` comments -- Function declarations and calls - -## Install locally (development) -1. Open the `rey-vscode/` folder in VSCode. -2. Press `F5` to launch an Extension Development Host. -3. Open a `.rey` file in the dev host and verify highlighting. - -## Install locally (VSIX) -1. Package the extension: - - `npx @vscode/vsce package` -2. Install the produced `.vsix`: - - `code --install-extension rey-lang-0.0.1.vsix` - -## Install from Marketplace -When published, search for `Rey` or `rey-lang` by `rey-language` in the VSCode Extensions view. diff --git a/rey-vscode/language-configuration.json b/rey-vscode/language-configuration.json deleted file mode 100644 index 670476a..0000000 --- a/rey-vscode/language-configuration.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "comments": { - "lineComment": "//" - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - "autoClosingPairs": [ - { "open": "{", "close": "}" }, - { "open": "[", "close": "]" }, - { "open": "(", "close": ")" }, - { "open": "\"", "close": "\"", "notIn": ["string", "comment"] } - ], - "surroundingPairs": [ - { "open": "{", "close": "}" }, - { "open": "[", "close": "]" }, - { "open": "(", "close": ")" }, - { "open": "\"", "close": "\"" } - ] -} diff --git a/rey-vscode/package.json b/rey-vscode/package.json deleted file mode 100644 index 5f506d1..0000000 --- a/rey-vscode/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "rey-lang", - "displayName": "Rey", - "description": "Syntax highlighting for the Rey programming language (.rey).", - "version": "0.0.1", - "publisher": "rey-language", - "license": "MIT", - "engines": { - "vscode": "^1.90.0" - }, - "categories": [ - "Programming Languages" - ], - "activationEvents": [ - "onLanguage:rey" - ], - "contributes": { - "languages": [ - { - "id": "rey", - "aliases": ["Rey", "rey"], - "extensions": [".rey"], - "configuration": "./language-configuration.json" - } - ], - "grammars": [ - { - "language": "rey", - "scopeName": "source.rey", - "path": "./syntaxes/rey.tmLanguage.json" - } - ] - } -} diff --git a/rey-vscode/syntaxes/rey.tmLanguage.json b/rey-vscode/syntaxes/rey.tmLanguage.json deleted file mode 100644 index c6ec19d..0000000 --- a/rey-vscode/syntaxes/rey.tmLanguage.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "Rey", - "scopeName": "source.rey", - "patterns": [ - { "include": "#comments" }, - { "include": "#strings" }, - { "include": "#numbers" }, - { "include": "#booleans" }, - { "include": "#null" }, - { "include": "#keywords" }, - { "include": "#types" }, - { "include": "#builtins" }, - { "include": "#functionDecl" }, - { "include": "#functionCall" } - ], - "repository": { - "comments": { - "patterns": [ - { - "name": "comment.line.double-slash.rey", - "match": "//.*$" - } - ] - }, - "strings": { - "patterns": [ - { - "name": "string.quoted.double.rey", - "begin": "\"", - "end": "\"", - "patterns": [ - { - "name": "constant.character.escape.rey", - "match": "\\\\." - } - ] - } - ] - }, - "numbers": { - "patterns": [ - { - "name": "constant.numeric.rey", - "match": "\\b\\d+(?:\\.\\d+)?\\b" - } - ] - }, - "booleans": { - "patterns": [ - { - "name": "constant.language.boolean.rey", - "match": "\\b(?:true|false)\\b" - } - ] - }, - "null": { - "patterns": [ - { - "name": "constant.language.null.rey", - "match": "\\bnull\\b" - } - ] - }, - "keywords": { - "patterns": [ - { - "name": "keyword.control.rey", - "match": "\\b(?:func|var|return|if|else|while|for|in|break|continue)\\b" - } - ] - }, - "types": { - "patterns": [ - { - "name": "storage.type.rey", - "match": "\\b(?:int|float|String|bool|Void|null)\\b" - } - ] - }, - "builtins": { - "patterns": [ - { - "name": "support.function.builtin.rey", - "match": "\\b(?:println|len|push|pop|input|range)\\b(?=\\s*\\()" - } - ] - }, - "functionDecl": { - "patterns": [ - { - "name": "meta.function.declaration.rey", - "match": "\\bfunc\\s+([A-Za-z_][A-Za-z0-9_]*)\\b", - "captures": { - "0": { "name": "keyword.control.rey" }, - "1": { "name": "entity.name.function.rey" } - } - } - ] - }, - "functionCall": { - "patterns": [ - { - "name": "meta.function-call.rey", - "match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\b(?=\\s*\\()", - "captures": { - "1": { "name": "entity.name.function.rey" } - } - } - ] - } - } -}