logoalt Hacker News

27.5KB language-agnostic WebGPU syntax highlighter

90 pointsby bpierretoday at 1:14 AM27 commentsview on HN

Comments

vova_hn2today at 7:59 AM

Years ago, long before the current "AI"/LLM-craze, I've heard someone saying that in the future programming will have less fixed, deterministic algorithms and more statistical/ML algorithms, because even in the case when writing a deterministic algorithm is possible, it is sometimes easier to collect training data and train a tiny model, then to write and maintain large codebase that does the same thing, but deterministically.

I wonder, if mass adoption of LLM code-generation will accelerate this process or not. On the one hand, it is now easier to "write" (LLM-generate) code then ever, so time/effort savings are not there anymore (probably, I'm not sure). On the other hand, now everyone uses LLMs so, I think, people are less deterred by non-determinism and statistical nature of ML models.

Let's imagine that you are making a CLI tool. What does a CLI tool do? Well, it accepts reads arguments, reads stdin, writes stdout and make syscalls. So, all possible inputs and outputs are very well defined. What if in the future it will be easier (and maybe even more natural) to ask an LLM to "imagine" tons of possible inputs and correct outputs for a tool that you are making and then train a tiny model, without writing or generating any code?

show 1 reply
undefeatedtoday at 8:01 AM

A genuinely impressive and novel use of machine learning? In this economy?

Looks really impressive, although one issue I do see is consistency. For example, it seems to highlight `null` as a value, unless it is on the left side of an `===` expression, since it probably hasn't seen that in training.

Was it ever actually tested on languages not in the training set? Would be interesting to see if a model this small can actually generalize...

netghosttoday at 4:29 AM

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.

thangalintoday at 4:16 AM

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...

LatticeAnimaltoday at 4:45 AM

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?

show 2 replies
tikimcfeetoday at 3:58 AM

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.

show 1 reply
1001111today at 10:01 AM

Window 98 Emulator for .exe syntax in C++ would return reference level in .cpp clang script.

brainlesstoday at 4:33 AM

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.

quietrastertoday at 7:52 AM

nice, a tiny webgpu model instead of a grammar is such a clean idea. how does it hold up on languages with really

onion2ktoday at 2:09 AM

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.

show 1 reply
drakmailtoday at 2:07 AM

Seems don't work on firefox mobile on Android

show 1 reply
hyperhellotoday at 3:43 AM

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

muglugtoday at 3:22 AM

> 95–100% agreement for actionscript

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

dolmentoday at 9:06 AM

"27.5KB" will not age well.

But what could I expect from another vibe coded project?