Extension update for vasm

This commit is contained in:
allexanderbergmns
2026-08-26 13:35:56 +02:00
parent 1d829c3ef2
commit 1b36deaabb
7 changed files with 166 additions and 3 deletions
+29
View File
@@ -0,0 +1,29 @@
; math.vasm — raw bytecode, hand-written in VuurRaaf assembly.
; Assemble + link + run with:
; vr assemble examples/math.vasm
; vr link math.vobj -o math.vbin
; vr run math.vbin
.global main
main:
push_int 6
push_int 7
mul
println
push_str "computed 6 * 7 = 42"
println
push_int 40
push_int 2
call add 2 ; calls the exported `add` symbol below
println
halt
; a callable function: takes two args, returns their sum
.global add
add:
enter 0 ; no extra locals (args were copied in by `call`)
load 0
load 1
add
retv
+10
View File
@@ -12,6 +12,9 @@ const vscode = require('vscode');
const DEMO_URI = vscode.Uri.file(
path.join(__dirname, '..', 'fixtures', 'workspace', 'demo.vr')
);
const VASM_URI = vscode.Uri.file(
path.join(__dirname, '..', 'fixtures', 'workspace', 'math.vasm')
);
async function openDemo() {
const doc = await vscode.workspace.openTextDocument(DEMO_URI);
@@ -37,6 +40,13 @@ suite('VuurRaaf extension', function () {
test('vuurraaf language (grammar) is registered', async function () {
const langs = await vscode.languages.getLanguages();
assert.ok(langs.includes('vuurraaf'), 'vuurraaf language id not registered');
assert.ok(langs.includes('vuurraaf-asm'), 'vuurraaf-asm language id not registered');
});
test('.vasm files get the vuurraaf-asm language id', async function () {
const doc = await vscode.workspace.openTextDocument(VASM_URI);
await vscode.window.showTextDocument(doc);
assert.strictEqual(doc.languageId, 'vuurraaf-asm', 'expected vuurraaf-asm, got ' + doc.languageId);
});
test('language server publishes compiler diagnostics', async function () {