alt.hn

2/25/2026 at 6:28:37 PM

Show HN: I ported Tree-sitter to Go

https://github.com/odvcencio/gotreesitter

by odvcencio

2/25/2026 at 7:01:02 PM

Oh this is really neat for the Bazel community, as depending on tree-sitter to build a gazelle language extension, with Gazelle written in Go, requires you to use CGO.

Now perhaps we can get rid of the CGO dependency and make it pure Go instead. I have pinged some folks to take a look at it.

by sluongng

2/25/2026 at 10:06:10 PM

would also be nice to have this support gopackagesdriver backend

by dilyevsky

2/25/2026 at 7:12:57 PM

thanks so much for the note! i really appreciate it. i built this precisely for folks like yourself with this specific pain, thanks again!

by odvcencio

2/25/2026 at 7:07:41 PM

Wouldn't `got` be confused with OpenBSD's Got: https://gameoftrees.org/index.html

by 3rly

2/25/2026 at 11:12:32 PM

Why would people be confused with something that the vast majority never heard of. Naming shouldn't care about none mainstream project.

by Thaxll

2/25/2026 at 7:11:37 PM

oh wow! i really thought i was being too clever but i shouldve assumed nothing new under the sun. well im taking name suggestions now!

by odvcencio

2/25/2026 at 7:52:48 PM

Well, find and sed have modern "fd" and "sd" alternatives. Naming it "gt" allows you to claim that your version save 33% compared to typing "git".

by allknowingfrog

2/26/2026 at 12:20:52 AM

gotgit, gotcha

by rapnie

2/25/2026 at 7:26:27 PM

Goty McGotface

by boobsbr

2/25/2026 at 7:51:13 PM

uGOT / uGOTme? (sort of like the idea behind uTorrent) but I will agree that sbankowi's idea of Yet another got is great as well. +1 to that as well.

by Imustaskforhelp

2/25/2026 at 7:35:53 PM

YAGOT (Yet Another GOT)

by sbankowi

2/25/2026 at 7:54:35 PM

Probably taken already, better use YAGOT-NG (Next Generation) just to be safe.

by bityard

2/25/2026 at 8:03:17 PM

might be taken too so just YAGOT2 would work

by himata4113

2/25/2026 at 11:36:15 PM

Can someone please explain what's the connection between this and LSP? For example in Helix can one use this instead of various language servers?

by kopirgan

2/25/2026 at 11:48:49 PM

Tree-sitter is merely a tool for generating an AST for a given language. LSPs on the other hand have way more capabilities (formatting, diagnostics, project-wise go to definition, inlay hints, documentation on hover, etc.) as you can see in its specification.[0] They can't really replace one another.

[0]: https://microsoft.github.io/language-server-protocol/specifi...

by mojifwisi

2/25/2026 at 8:23:35 PM

This is great, I was looking for something like this, thanks for making this!

I imagine this can very useful for Go-based forges that need syntax highlighting (i.e. Gitea, Forgejo).

I have a strict no-cgo requirement, so I might use it in my project, which is Git+JJ forge https://gitncoffee.com.

by shayief

2/25/2026 at 8:26:49 PM

thank you for the kind words! Very cool project! Very happy you can find some utility in it

by odvcencio

2/25/2026 at 8:27:06 PM

Do you have an equivalent of TreeCursors or tree-sitter-generate?

There are at least some use cases where neither queries nor walks are suitable. And I have run into cases where being able to regenerate and compile grammars on the fly is immeasurably helpful.

At least for my use cases, this would be unusable.

Also, what the hell is this:

> partial [..] missing external scanner

Why do you have a parsing mode that guarantees incorrect outputs on some grammars (html comes to mind) and then use it as your “90x faster” benchmark figure?

by trickypr

2/25/2026 at 8:31:27 PM

the 90x figure is on Go source for apples to apples against CGO bound tree-sitter.

your use case is not one i designed for although yeah maybe the readme has some sections too close. the only external scanner missing atm is norg. now that i know your use case i can probably think of a way to close it

by odvcencio

2/25/2026 at 8:57:36 PM

So your benchmarks are primarily just “how fast is go’s c interop” rather than any algorithmic improvement on tree-sitter?

Edit: yep, you are just calling a c function in a loop. So your no-op benchmark is just the time it takes for cgo to function. I would not be able to get any perf benefits from e.g. rust

by trickypr

2/25/2026 at 8:17:17 PM

Claude attempted a treesitter to go port

Better title

by acedTrex

2/25/2026 at 8:23:01 PM

I work on a revision control system project, except merge is CRDT. On Feb 22 there was a server break-in (I did not keep unencrypted sources on the client, server login was YubiKey only, but that is not 100% guarantee). I reported break-in to my Telegram channel that day.

My design docs https://replicated.wiki/blog/partII.html

I used tree-sitter for coarse AST. Some key parts were missing from the server as well, because I expected problems (had lots of adventures in East Asia, evil maids, various other incidents on a regular basis).

When I saw "tree-sitter in go" title, I was very glad at first. Solves some problems for me. Then I saw the full picture.

by gritzko

2/25/2026 at 9:00:50 PM

Wait, are you suggesting that OP broke in to your server and stole code and is republishing it as these repos?

I have questions. Have you reviewed the code here to see if it matches? What, more specifically, do you mean when you say someone broke in? What makes you think that this idea (which is nice but not novel) is worth stealing? If that sounds snarky, it’s not meant to; just trying to understand what’s going on. Why is that more likely than someone using Claude to vibe up some software along the same lines?

by ctmnt

2/25/2026 at 9:31:30 PM

1. Just saying, strange coincidence

2. How can we compare Claude's output in a different language?

3. Detecting break-ins and handling evil-maids: unless the trick is already known on the internets, I do not disclose. Odds are not in my favor.

4. Maybe worth, maybe not. I have my adaptations. Trying to make it not worthy of stealing, in fact.

by gritzko

2/25/2026 at 10:36:56 PM

Based on this and your other comments, including the one that’s no longer visible: Please phone a friend. Or find a professional to talk to. I say that with nothing but compassion.

by ctmnt

2/25/2026 at 11:42:47 PM

For the people who are downvoting me: I’m being totally sincere. This is not an ad hominem attack. You didn’t see his other comment, it was genuinely concerning.

by ctmnt

2/26/2026 at 12:30:01 AM

This is a trick. There was no "other comment"

by gritzko

2/25/2026 at 9:05:21 PM

Also, evil maids, what?

by ctmnt

2/25/2026 at 9:30:29 PM

I can't speak for the specificity of parent's "evil maids" phrase but the concept of an "Evil maid" is used in security scenarios.

A maid tends to be an example of a person who's mostly a stranger, but is given unmonitored access to your most private spaces for prolonged periods of time. So they theoretically become a good vector for a malicious actor to say "hey I'll give you $$ if you just plug in this USB drive in his bedroom laptop next time you're cleaning his house" - it's often used in the scenario of "ok what if someone has physical access to your resource for a prolonged period of time without you noticing? what are your protections there?"

I wonder if that's what OP meant? :-)

by atonse

2/25/2026 at 9:33:31 PM

"Evil maids" (example): I put my laptop into a safe, seal the safe, seal the room, go to breakfast. On return, I see there was cleaning (not the usual time, I know the hotel), the cleaner looks strangely confused, the seal on the safe is detached (that is often done by applying ice; adhesive hardens, seal goes off). This level of paranoia was not my norm. Had to learn these tricks cause problems happened (repeatedly). In fact, I frequented that hotel, knew customs and the staff, so noticed irregularities.

by gritzko

2/25/2026 at 10:12:26 PM

Ah right, thanks! But it seems he meant literal evil maids. Which I guess count as the figurative kind too.

by ctmnt

2/25/2026 at 9:31:46 PM

This was my first thought as well, just from reading the title.

by thebackup

2/25/2026 at 8:22:38 PM

How is OP using Claude relevant?

by red_hare

2/25/2026 at 8:30:34 PM

OK for prototyping. Not OK for prod use if noone actually read it line by line.

by gritzko

2/25/2026 at 11:25:11 PM

I’m just curious, what would need to happen for you to change your opinion about this? Are you basically of the opinion that it’s not good enough today, never will be good enough in the future, and we should just wind back the clock 3 years and pretend these tools don’t exist?

It feels to me like a lot of this is dogma. If the code is broken or needs more testing, that can be solved. But it’s orthogonal: the LLM can be used to implement the unit testing and fuzz testing that would beat this library into shape, if it’s not already there. It’s not about adding a human touch, it’s about pursuing completeness. And that’s true for all new projects going from zero to one, you have to ask yourself whether the author drove it to completeness or not. That’s always been true.

You want people to hedge their projects with disclaimers that it probably sucks and isn’t production worthy. You want them to fess up to the fact that they cheated, or something. But they’re giving it away for free! You can just not use it if you don’t want to! They owe you nothing, not even a note in the readme. And you don’t deserve more or less hacker points depending on whether you used a tool to generate the code or whether you wrote it by hand, because hacker points don’t exist, because the value of all of this is (and always will be) subjective.

To the extent that the modern tools and models can’t oneshot anything, they’re going to keep improving. And it doesn’t seem to me like there’s any identifiable binary event on the horizon that would make you change your mind about this. You’re just against LLMs, and that’s the way it is, and there’s nothing that anyone can do to change your mind?

I mean this in the nicest way possible: the world is just going to move on without you.

by nickysielicki

2/26/2026 at 12:45:58 AM

I tried to control LLM output quality by different means, including fuzzing. Had several cases when LLM cheated on that too. So, I have my own shades and grades of being sure the code is not BS.

by gritzko

2/25/2026 at 11:31:51 PM

This might be true, but we can continue to try and require the communities we have been part of for years to act a certain way regarding disclosures.

If the community majority changes it mind then so be it. But the fight will continue for quite some time until that is decided.

by acedTrex

2/25/2026 at 11:45:27 PM

There never was a cohesive generic open source community. There are no meaningful group norms. This was and always will be a fiction.

I’m tempted to just start putting co-authored-by: Claude in every commit I make, even the ones that I write by hand, just to intentionally alienate people like you.

The best guardrails are linters, autoformatters, type checkers, static analyzers, fuzzers, pre-commit rules, unit tests and coverage requirements, microbenchmarks, etc. If you genuinely care about open source code quality, you should be investing in improving these tools and deploying them in the projects you rely on. If the LLMs are truly writing bad or broken code, it will show up here clearly.

But if you can’t rephrase your criticism of a patch in terms of things flagged by tools like those, and you’re not claiming there’s something architecturally wrong with the way it was designed, you don’t have a criticism at all. You’re just whining.

by nickysielicki

2/26/2026 at 12:04:16 AM

I see this as the same argument as saying GMO label not needed, no need to mention artificial flavours in food, etc.

I mean this in the nicest way possible: the world is just going to insist that AI generated output is marked clearly as AI produced output.

Not sure whether giving a LICENSE even makes sense.

by lenkite

2/25/2026 at 8:33:25 PM

ii am trying to not take issue with this comment because im aware of the huge stigma around ai generated code.

i needed this project so i made it for my use case and had to build on top of it. the only way to ensure quality is to read it all line by line.

if you give me code that you yourself have not reviewed i will not review it for you.

by odvcencio

2/25/2026 at 8:48:04 PM

That ship has sailed, man…

by znpy

2/25/2026 at 9:12:26 PM

No it has not - if it had, there'd be no need to shout down folk who disagree.

Not everyone buys into the inevitabilism. Why should I read code "author" didn't bother to write?

by overfeed

2/25/2026 at 9:33:27 PM

Sorry but these are just not accurate as blanket statements anymore, given how good the models have gotten.

As other similar projects have pointed out, if you have a good test suite and a way for the model to validate its correctness, you can get very good results. And you can continue to iterate, optimize, code review, etc.

by atonse

2/25/2026 at 9:04:08 PM

People should say what models/tools they used in even show the prompts.

by ks2048

2/25/2026 at 10:18:14 PM

Because the entire README doesn't even mention it, and it is an important factor in deciding whether it is ready for production use.

I, for one, am definitely not going to use this project for anything serious unless I have thoroughly reviewed the code myself. Prototyping is fine.

by g947o

2/25/2026 at 9:34:37 PM

Because OP obviously downplayed this important fact, which typically shows lower quality/less tested code.

by up2isomorphism

2/25/2026 at 8:23:02 PM

maintenance burden

by DeepYogurt

2/25/2026 at 8:36:04 PM

AI often produces nonsense that a human wouldn't. If a project was written using AI the chances that it is a useless mess are significantly higher than if it was written by a human.

by IshKebab

2/25/2026 at 8:20:13 PM

well how did it do?

by odvcencio

2/25/2026 at 9:03:36 PM

Hard to say. Claude’s very good at writing READMEs. In fact, Copilot often complains about docs that sound like they’re about current capabilities when in fact they’re future plans or just plan aspirational.

Without downloading and testing out your software, how can we know if it’s any good? Why would we do that if it’s obviously vibed? The dilemma.

I’m not at all against vibe coding. I’m just pointing out that having a nice README is trivial. And the burden of proof is on you.

by ctmnt

2/25/2026 at 8:23:38 PM

Shouldn't you be able to answer that?

by wocram

2/25/2026 at 8:24:30 PM

yes and if you clicked the links you would know that i did answer it in the readme.

by odvcencio

2/25/2026 at 10:38:27 PM

I read the README and did not find answers to my questions.

by ctmnt

2/25/2026 at 8:36:14 PM

But how do we know the readme isn't also vibecoded?

by mathfailure

2/25/2026 at 8:32:10 PM

> Pure-Go tree-sitter runtime — no CGo, no C toolchain, WASM-ready.

No you didn't. The readme is obvious LLM slop. Em-dash, rule of three, "not x, y". Why should anyone spend effort reading something you couldn't be bothered to write? Why did you post it to HN from a burner account?

by do_not_redeem

2/25/2026 at 7:37:07 PM

That is very very interesting. I work on a similar project https://replicated.wiki/blog/partII.html

I use CRDT merge though, cause 3-way metadata-less merges only provide very incremental improvements over e.g. git+mergiraf.

How do you see got's main improvement over git?

by gritzko

2/25/2026 at 7:51:19 PM

primarily, got is structural VCS intended for concurrent edits of the same file.

it does this via gotreesitter and gts-suite abstractions that enable it to: - have entity-aware diffs - not line by line but function by function - structural blame - attribution resolution for the lifetime of the entity - semver from structure - it can recommend bumps because it knows what is breaking change vs minor vs patch - entity history - because entities are tracked independently, file renames or moves dont affect the entity's history

when gotreesitter cant parse a language, the 3way text merge happens as a fallback. what the structural merge enables is no conflicts unless same entity has conflicting changes

by odvcencio

2/25/2026 at 7:55:49 PM

I think I understand the situation.

by gritzko

2/25/2026 at 7:54:56 PM

gah,. sincere apologies for formatting of this post. i ahve been on HN for basically 10 years now without ever having made a post (:

by odvcencio

2/25/2026 at 7:59:57 PM

use four spaces " " in front of a line for <pre> formatting

    like "    this"

by dorianmariecom

2/25/2026 at 8:02:54 PM

It's 2 or more spaces, not four

by srcreigh

2/25/2026 at 8:03:17 PM

It looks like porting the custom C lexers is a big part of the trouble you had to go to do this.

by conartist6

2/25/2026 at 8:09:18 PM

yes basically about 70% of the engineering effort was spent porting the external scanners and ensuring parity with original (C) tree-sitter

by odvcencio

2/25/2026 at 8:00:02 PM

Interesting. I have a similar usecase but intended to use CGo tree-sitter with Zig

Are these pretty up-to-date grammars? I'm awfully tempted to switch to your project

How large are your binaries getting? I was concerned about the size of some of the grammars

by jbreckmckye

2/25/2026 at 8:06:54 PM

206 binary blobs = 15MB, so not crazy but i built for this use case where you can declare the registry of languages you want to load and not have to own all the grammar binaries by default

by odvcencio

2/25/2026 at 8:08:27 PM

If all the languages together add up to 15MB that is a game changer for me.

It means the CLI I am working on can ship support for many languages whilst still being a smallish (sub 50mb) download

I shall definitely check it out!

by jbreckmckye

2/25/2026 at 8:10:34 PM

re: up to date grammars, yes i found the official grammars in use by the original tree-sitter library today

by odvcencio

2/25/2026 at 7:43:17 PM

How about making 'got' compatible with git repos like jujutsu? It would be a lot easier to try out.

by skybrian

2/25/2026 at 7:53:34 PM

it is interoperable with git. we like git when its good but attempted to ease the pains in UX somewhat. you can take advantage of got locally but still push it to git remote forges jsut the same. when you pull stuff in this way, got will load the entity history into the git repo ensuring that you can still do got stuff locally (inspect entity histories, etc)

by odvcencio

2/25/2026 at 9:31:39 PM

"rewrite" a nice code base without mentioning it is vibe coded is not great.

Essentially you use AI to somehow re-implement the original code base in a different language, made it somehow work, and claim it is xx times faster. It is misleading.

by up2isomorphism

2/25/2026 at 10:04:37 PM

i really appreciated this comment the most because of how much work "somehow" is doing here

by odvcencio

2/25/2026 at 7:54:40 PM

Is it a go-ism that source for implementation and test code lives in the root of the repo or is this an LLM thing?

by irishcoffee

2/25/2026 at 7:58:17 PM

yeah the tests live with the implementation code always (Go thing) and the repo root thing is like a preference, main is an acceptable package to put stuff in (Go thing), i see this a lot with smaller projects or library type projects

by odvcencio