27.5KB language-agnostic WebGPU syntax highlighter

bpierre 45 points 15 comments September 09, 2026
gpu-lexer.vercel.app · View on Hacker News

Discussion Highlights (9 comments)

drakmail

Seems don't work on firefox mobile on Android

onion2k

I don't think it's meant as something that's useful per se because highlighting 5m lines of code at once is unusual, and doing it in a non-deterministic way probably isn't especially helpful, but to show what a browser is capable of it's awesome.

muglug

> 95–100% agreement for actionscript Great news for a language whose last stable release was 20 years ago

hyperhello

Does this do the tokenization? Could it be expanded to parse the whole structure of the language?

tikimcfee

If anyone can get in contact with Shu, please let them know I'd really like to speak with them. I have a deterministic rendering / colorizing system in three dimensions instead of two for arbitrary UTF8 text written that is explicitly GPU bound and currently testing the last Rust + Mojo pair port, and I'd like to share some ideas. I have about 95 million glyphs rendering (monospace, atm) in a little under a second with full multi dimensional pagination and colorizing per-glyph with full addressing capabilities. There's something to be combined with these two mechanisms I'd like to try and explore.

thangalin

27 KB is extraordinarily impressive. Here's a deterministic suite of common language- and format-specific PHP files an LLM wrote for me in 32 KB, for comparison: https://repo.autonoma.ca/repo/treetrek/tree/HEAD/render/rule...

netghost

I think what's most interesting is not that this works well for common languages, but it seems to be useful for languages that don't exist yet. If you want _some_ highlighting for your SQL variant, or your language that borrows many common idioms, or just sloppy code that's close enough to the target language, this could be useful.

brainless

This is a tiny LLM doing all the heavy-lifting. Any mention of the training process? I am obsessed with tiny LLMs and the do-one-thing-really-well approach that they seem to fit very well.

LatticeAnimal

On linux (tried FF and chromium), the live demo renders all the text as black (no highlighting). On iOS (my phone), this works great. No errors in the console (maybe it fails silently?) Is this a linux issue / support issue?

Semantic search powered by Rivestack pgvector
5,917 stories · 53,755 chunks indexed