Mecrisp-Stellaris LSP + Forth Forge: an LSP fed by a silicon-verified word gate
I've been using a language server for Mecrisp-Stellaris Forth I released seven months ago, and the part I want to share is the pipeline behind it — because it's not a static word list. Every word in the LSP has to pass a hardware-verified gate before it's admitted.
**The LSP**
It's a standard Language Server Protocol implementation built on pygls, the Python framework for the protocol. That means it works with any LSP-compliant editor — Helix, NeoVim, and anything else that speaks the protocol (only tested on Helix and NeoVim). Completion, hover documentation, and diagnostics all run through the standard JSON-RPC channel. The completion database is SQLite.
**The approval gate — "the Anvil"**
A word doesn't enter the LSP because someone thinks it's clever. It passes seven checks, each one real:
**Design** — valid Forth name, no collision with the CMSIS-SVD register database.
**Stack comment** — the declared inputs/outputs must parse correctly. On bare metal, a wrong stack effect is a crash.
**Explanation** — a real descrHelix,·NeoVimiption, and an example where the word takes input.
**Live execution** — the word runs on an actual STM32 over the SWD debug link; the result must match the expected value.
**Native disassembly** — the chip's own disassembler (Mecrisp's `see`) produces the machine code, which is reviewed to confirm the word does what it should.
**Board gate** — the connected chip's DEV_ID is checked against what the word requires (F0 vs F4); the gate refuses to test a word on the wrong board.
**Independent register readback** — the word's result is written into a real GPIO output data register, then read back through a separate path. If the expected value is physically in the silicon, the word works. Not "it didn't crash" — the value is there, confirmed.
Words that fail any check stay out of the LSP. Only words that pass the full gate are suggested by the editor.
**Forth Forge**
The gate feeds a shared vocabulary I'm planning to host on SourceForge. Forth users can submit STM32 Forth words — Mecrisp-Stellaris, STM32 only, because the gate works off the CMSIS-SVD register descriptions (roughly sixty STM32 families, plenty of choice). Each submission goes through the Anvil; if it passes, it's added to a maintained list where every word carries its stack comment, description, and the evidence it was hardware-verified. Anyone can grab the list and trust that the words have been tested on real silicon.
The goal is a common, working vocabulary for Mecrisp-Stellaris on STM32 — so Forth code can travel between projects and actually work, because the words have been proven.
MIT-licensed. The modified LSP and the gate are being prepared for public release alongside Forth Forge.
(If you're a Forth user doing STM32 work, submissions welcome. If you've got a word you've tested on your bench, that's exactly what the Anvil is for.)
Constructive comments and helpful suggestions welcomed.