iroddis 13 hours ago

Thank you for posting, I’ve been eyeing using TreeSitter to make some toy languages, and this looks like a great example to learn from.

The error.rs error type definitions and the pub(crate) directives were both new to me. It’s crazy to me just how much rust continues to evolve well after the 1.0 release. Error handling in particular seems to be a point of confusion; I’ve seen (and bookmarked) many posts on HN about it. The thiserror crate was new to me, and seems really nice.

  • jasonjmcghee 12 hours ago

    I've been enjoying tree-sitter, using it for a larger project now. I found it more intuitive than peg, but certainly comes with more... weight (entire subfolder, bindings, build process etc) and is more verbose. But can simplify syntax highlighting and other editor related things. Zed uses it extensively, and all you need are queries for each of the features (https://zed.dev/docs/extensions/languages)

    Miette is responsible for actually rendering the error messages you see- which was new to me, but have always appreciated how that style of error looks and is so much more helpful than "[1:23]"

iwwr 19 hours ago

So what does it do?

  • GrumpyNl 18 hours ago

    There is a demo video on the page.