>_EXECUTIVE SUMMARY
emacs-stryke is the Emacs major mode for stryke — a highly parallel Perl 5 superset interpreter written in Rust. stryke-mode derives from prog-mode and provides font-lock, a syntax table, brace-aware indentation, filetype detection, and an LSP client that launches stryke --lsp.
Design principle: the highlighted surface is not a hand-picked subset and not a reskin of a Perl mode. scripts/gen-stdlib.sh dumps %b (builtins), %k (keywords), and $c{parallel} from the live binary and writes stryke-stdlib.el carrying the complete language surface — all 10,409 builtins. Regenerate after a stryke upgrade and it stays in sync.
~WHY HASH TABLES, NOT ONE REGEXP
The natural approach — (regexp-opt builtins 'symbols) over all 10,409 names — produces a regexp that Emacs' own compiler rejects with invalid-regexp "Regular expression too big". So the generator instead emits two hash tables (stryke-builtins-table, stryke-parallel-table), and a font-lock matcher function walks identifiers with a generic \_<…\_> regexp and looks each one up in O(1). The two sets are disjoint, so parallel primitives get their own face without conflicting with the general builtin face. Small categories (keywords, types) still use a plain regexp-opt — they are well under the limit.
| Component | Detail |
|---|---|
stryke-mode.el | Major mode — syntax table (# comments, string quotes, sigils as punctuation), font-lock keyword list, stryke-indent-line, eglot + lsp-mode registration, auto-mode-alist + interpreter-mode-alist. |
stryke-stdlib.el | Generated data — the two builtin hash tables (170 KB). Byte-compiles cleanly; loads instantly. |
scripts/gen-stdlib.sh + gen-stdlib.el | Dump %b / $c{parallel} from the binary; build the tables entirely inside Emacs (no shell escaping touches the data). |
scripts/face-test.el | Fontify a sample buffer and assert the face at each probe token. |
$VERIFICATION
CI byte-compiles the package with byte-compile-error-on-warn (warnings are errors) and runs the batch face test. Each probe asserts the actual face text-property after font-lock-ensure.
| Sample token | Asserted face |
|---|---|
fn / use / my / async / await | font-lock-keyword-face |
Str | font-lock-type-face |
say | font-lock-builtin-face |
pmap | stryke-parallel-face |
absorbance (deep builtin) | font-lock-builtin-face |
contains | font-lock-builtin-face |
| double-quoted string | font-lock-string-face |
# comment | font-lock-comment-face |