{"id":30852670,"url":"https://github.com/devlights/try-treesitter","last_synced_at":"2025-10-08T20:23:12.830Z","repository":{"id":306403614,"uuid":"1026056560","full_name":"devlights/try-treesitter","owner":"devlights","description":"This is my TUTORIAL project for tree-sitter.","archived":false,"fork":false,"pushed_at":"2025-08-12T03:02:00.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-07T08:21:20.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/devlights.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,"zenodo":null}},"created_at":"2025-07-25T08:34:47.000Z","updated_at":"2025-08-12T03:02:03.000Z","dependencies_parsed_at":"2025-07-25T14:34:32.144Z","dependency_job_id":"e4aa004f-3def-4c77-86d2-31dabf606a13","html_url":"https://github.com/devlights/try-treesitter","commit_stats":null,"previous_names":["devlights/try-treesitter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devlights/try-treesitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Ftry-treesitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Ftry-treesitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Ftry-treesitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Ftry-treesitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/try-treesitter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Ftry-treesitter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000659,"owners_count":26082817,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-07T08:07:00.306Z","updated_at":"2025-10-08T20:23:12.808Z","avatar_url":"https://github.com/devlights.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# try-treesitter\n\nThis is my TUTORIAL project for tree-sitter.\n\n## tree-sitterとは\n\n[tree-sitter-doc](https://tree-sitter.github.io/tree-sitter/)にライブラリの紹介が書いてあります。\n\n\u003e Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited. Tree-sitter aims to be:\n\n\u003e (Tree-sitterは構文解析ツールであり、インクリメンタル構文解析ライブラリである。ソースファイルの具体的な構文ツリーを構築し、ソースファイルの編集に応じて構文ツリーを効率的に更新することができます。Tree-sitterは次のようなことを目指しています：)\n\n\u003e General enough to parse any programming language (あらゆるプログラミング言語を解析できる汎用性)\n\n\u003e Fast enough to parse on every keystroke in a text editor (テキストエディタでのすべてのキーストロークを解析するのに十分な速度)\n\n\u003e Robust enough to provide useful results even in the presence of syntax errors (構文エラーがあっても有用な結果を提供できるほど頑健である。)\n\n\u003e Dependency-free so that the runtime library (which is written in pure C11) can be embedded in any application (依存性がないため、ランタイムライブラリ（純粋なC11で書かれている）をあらゆるアプリケーションに組み込むことができる。)\n\n## tree-sitterを使ったソースファイルの解析\n\n[tree-sitter](https://github.com/tree-sitter/tree-sitter)は、インクリメンタル（増分）な構文解析が可能なパーサジェネレータ・ライブラリです。\n[tree-sitter-doc](https://tree-sitter.github.io/tree-sitter/)に公式ドキュメントがあります。\n\nいろいろな言語の構文にデフォルトで対応しており、独自の構文解析を構築することも出来ます。\n\nまた、様々なプログラム言語に対してのバインディングも存在します。（Go,Python,C#,Javaのバインディングは公式対応）\n\n## tree-sitterの用意\n\n例題としてC言語のソースファイルを解析する場合は以下のようにバインディングライブラリを選択します。\n\n```go\n$ go get github.com/tree-sitter/go-tree-sitter@latest\n$ go get github.com/tree-sitter/tree-sitter-c/bindings/go@latest\n```\n\nGoのバインディングは、これで完了です。\n\n## tree-sitter-cliの用意\n\n```sh\n$ cargo install tree-sitter-cli\n```\n\n### CLIのためにC言語バインディングを配置\n\n```sh\n$ cd\n$ tree-sitter init-config\n$ mkdir -p ~/tree-sitter-parsers\n$ cd ~/tree-sitter-parsers\n$ git clone https://github.com/tree-sitter/tree-sitter-c.git\n```\n\n```~/.config/tree-sitter/config.json```のparser-directoriesを以下のように設定します。。\n\n```json\n  \"parser-directories\": [\n    \"/home/dev/tree-sitter-parsers\"\n  ],\n```\n\nこれでCLI側で構文木が出力できるようになる。デバッグ時などに便利。\n\n```sh\n$ tree-sitter parse app.c\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Ftry-treesitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Ftry-treesitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Ftry-treesitter/lists"}