{"id":19358062,"url":"https://github.com/faveod/grenadier-old","last_synced_at":"2026-07-18T13:12:48.622Z","repository":{"id":73420847,"uuid":"501105635","full_name":"Faveod/grenadier-old","owner":"Faveod","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-28T07:36:20.000Z","size":198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-24T11:49:49.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Faveod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-08T04:57:42.000Z","updated_at":"2022-07-28T08:03:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"51146a0a-74c6-41e2-8afd-08df2f4130ea","html_url":"https://github.com/Faveod/grenadier-old","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Faveod/grenadier-old","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faveod%2Fgrenadier-old","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faveod%2Fgrenadier-old/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faveod%2Fgrenadier-old/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faveod%2Fgrenadier-old/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Faveod","download_url":"https://codeload.github.com/Faveod/grenadier-old/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Faveod%2Fgrenadier-old/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262432403,"owners_count":23310240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T07:10:10.321Z","updated_at":"2025-10-17T19:32:40.532Z","avatar_url":"https://github.com/Faveod.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Grenadier\n\n[![ci](https://github.com/Faveod/grenadier/actions/workflows/ci.yml/badge.svg)](https://github.com/stackmystack/grenadier/actions/workflows/ci.yml)\n\nRuby bindings for [tree-sitter](https://github.com/tree-sitter/tree-sitter).\n\nThe [official bindings](https://github.com/tree-sitter/ruby-tree-sitter) are\nvery old, and unmaintained; it doesn't work with modern `tree-sitter` APIs.\n\n## About\nThe main philosophy behind these bindings is to do a 1:1 mapping between\ntree-sitter's `C` API and `Ruby`.\n\nIt doesn't mean that we're going to yield the best perormance, but this design\nallows us to better experiment, and easily port ideas from other projects.\n\nThis design also implies that you need to be extra-careful when playing with the\nprovided objects.  Some of them have their underlying `C` data-structure\nautomatically freed, so you might get yourself in undesirable situations if you\ndon't pay attention to what you're doing.\n\nWe're only talking about `Tree`, `TreeCursor`, `Query`, and `QueryCursor`.  Just\ndon't copy them left and right, and then expect them to work without\n`SEGFAULT`ing and creating a black-hole in your living-room.  Assume that you\nhave to work locally with them.\n\nThat said, we do aim at providing an idiomatic `Ruby` interface.  It should also\nprovide a _safer_ interface, where you don't have to worry about when and how\nresources are freed.\n\nTo See a full list of the ruby-specific APIs, see [here](lib/README.md).\n\n## Grenadier?\n\nA _grenadier_ is a pomegrenate tree.  Pomegrenate fruits are ruby.  And they sit\non the grenadier.\n\n## Dependencies\n\nThis gem is a binding for `tree-sitter`.  It doesn't have a version of\n`tree-sitter` baked in it.\n\nYou must install `tree-sitter` and make sure that their dynamic library is accessible\nfrom `$PATH`, or build the gem with `--disable-sys-libs` (see [Install](#Install))\n\nYou can either install `tree-sitter` from source or through your go-to package manager.\n\n### Linux\n\n`ubuntu \u003e= 22.04`\n\n```console\nsudo apt install libtree-sitter-dev\n```\n\n`arch`\n\n```console\nsudo pacman -S tree-sitter\n```\n\n### MacOS\n\n```console\nsudo port install tree-sitter\n```\n\nor\n\n```console\nbrew install tree-sitter\n```\n\n### Windows\n\nIt's not supported for the time being.  If you care about it please provide a patch.\n\nOr if you use `WSL`, then follow the [Linux](#Linux) section above.\n\n## Install\n\nWe haven't released the gem on `Rubygems` as of yet, but wer'e planning on doing so.\n\nMeanwhile, please build from source.\n\n### Gemfile\n\n```ruby\ngem tree_sitter, git: 'https://github.com/stackmystack/grenadier'\n```\n\n### Build from source\n\n```console\ngit clone https://github.com/stackmystack/grenadier\nbundle install\nbundle exec rake compile\n```\n\nIf you chose not to install and bother with `tree-sitter` installation:\n\n``` console\nbundle exec rake compile -- --disable-sys-libs\n```\n\n\nYou can now jump into a REPL and start experimenting with Grenadier:\n\n```console\nbundle exec rake console\n```\n\nOr you can build the gem then install it:\n\n```console\ngem build tree_sitter.gemspec\ngem install tree_sitter-x.x.x.gem\n```\n\n## Examples\n\nSee `examples` directory.\n\n## Development\n\nIf you want to hack on this gem, you only have to work with `rake compile` and\n`rake clean`.\n\nIt's advised to run `rake clean \u0026\u0026 rake compile` everytime you modify `C` code.\nI've run into trouble several times by not doing so.\n\n### ASAN\n\nYou can enable `asan` by setting the `SANITIZE` environment variable before building:\n\n```console\nSANITIZE=1 bundle exec rake compile\n```\n\nOn linux:\n\n``` console\nLD_PRELOAD==libasan.so.8 bundle exec rake test\n```\n\nThis is still experimental, and I haven't had any true success yet, but it's a good\nstart.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaveod%2Fgrenadier-old","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaveod%2Fgrenadier-old","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaveod%2Fgrenadier-old/lists"}