NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
27.5KB language-agnostic WebGPU syntax highlighter (gpu-lexer.vercel.app)
netghost 1 hours ago [-]
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.
thangalin 1 hours ago [-]
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...

tikimcfee 2 hours ago [-]
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.
tough 1 hours ago [-]
g@shud.in was listed as contact email on his older portfolio
LatticeAnimal 50 minutes ago [-]
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?

aitoolsprimer 24 minutes ago [-]
[flagged]
muglug 2 hours ago [-]
> 95–100% agreement for actionscript

Great news for a language whose last stable release was 20 years ago

brainless 1 hours ago [-]
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.
onion2k 3 hours ago [-]
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.
avaer 2 hours ago [-]
The use case isn't highlighting a huge amount of code, but local re-entrant highlighting.

You generally never need to highlight a whole file, only the part you're looking at. Which by definition must be fuzzy since you don't have the full source, the part you see will not parse as a complete program so you need to guess. This is actually one of the nastier parts of writing a highlighter, and it must be done for every language.

The lesson is that if you're going to be fuzzy you might as well be learned too and the results are pretty good.

This is more useful than it appears at first glance. It would be just as useful running on the CPU, which I'm sure it can.

umpalumpaaa 2 hours ago [-]
Is that really the use case for the related packages mentioned on their website? highlightjs and prismjs are typically used to highlight code snippets on websites… which are at most a few hundred lines long. And are usually highlighted as a whole
tough 1 hours ago [-]
you have to bundle and ship per language syntax dictionaries tho
normie3000 2 hours ago [-]
> the part you see will not parse as a complete program so you need to guess

Presumably this could also be a useful trait when live highlighting of files when editing, as in-progress typing is likely to be unparseable sometimes.

hyperhello 2 hours ago [-]
Does this do the tokenization? Could it be expanded to parse the whole structure of the language?
drakmail 3 hours ago [-]
Seems don't work on firefox mobile on Android
hmry 3 hours ago [-]
Firefox Android doesn't support WebGPU yet
3 hours ago [-]
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 05:35:43 GMT+0000 (Coordinated Universal Time) with Vercel.