### Install Nimtreesitter Package Source: https://github.com/genotrance/nimtreesitter/blob/master/README.md Install the main treesitter package using Nimble. This will download, wrap, and install the library. ```bash > nimble install treesitter ``` -------------------------------- ### Install Individual Language Grammars Source: https://context7.com/genotrance/nimtreesitter/llms.txt Install specific language grammars as needed. Each grammar is packaged as a separate Nimble module and can be installed independently. ```bash nimble install treesitter_c ``` ```bash nimble install treesitter_python ``` ```bash nimble install treesitter_javascript ``` ```bash nimble install treesitter_rust ``` ```bash nimble install treesitter_go ``` -------------------------------- ### Install Multiple Tree-sitter Grammars with Nimble Source: https://context7.com/genotrance/nimtreesitter/llms.txt Use the nimble install command to add multiple language grammars to your project. ```bash nimble install treesitter_c treesitter_python treesitter_javascript ``` -------------------------------- ### Install Language Grammar for C Source: https://github.com/genotrance/nimtreesitter/blob/master/README.md Install a specific language grammar, such as C, using Nimble. The treesitter library will be installed automatically if it's a dependency. ```bash > nimble install treesitter_c ``` -------------------------------- ### Install Core Treesitter Library Source: https://context7.com/genotrance/nimtreesitter/llms.txt Install the core treesitter wrapper using the Nimble package manager. This command downloads, generates bindings, and installs treesitter to the standard Nimble package location. ```bash nimble install treesitter ``` -------------------------------- ### Set Parser Language to Python Source: https://context7.com/genotrance/nimtreesitter/llms.txt Configure the parser to use the Python grammar. Ensure the `treesitter_python` package is installed. The `treeSitterpython()` function returns a pointer to the Python language definition. ```nim import treesitter/api import treesitter_python/python var parser = tsParserNew() # Configure parser for Python language assert parser.tsParserSetLanguage(treeSitterpython()) == true # Parser is now ready to parse Python source code parser.tsParserDelete() ``` -------------------------------- ### Create and Delete Parser Instance Source: https://context7.com/genotrance/nimtreesitter/llms.txt Create a new parser instance using `tsParserNew()`. Parsers must be explicitly deleted with `tsParserDelete()` when no longer needed to free allocated resources. ```nim import treesitter/api # Create a new parser instance var parser = tsParserNew() # Use the parser for parsing operations... # Clean up when done parser.tsParserDelete() ``` -------------------------------- ### Set Parser Language to Go Source: https://context7.com/genotrance/nimtreesitter/llms.txt Configure the parser to use the Go grammar. This enables building Go code analysis tools in Nim. The `treeSittergo()` function returns a pointer to the Go language definition. ```nim import treesitter/api import treesitter_go/go var parser = tsParserNew() # Configure parser for Go language assert parser.tsParserSetLanguage(treeSittergo()) == true # Parser is now ready to parse Go source code parser.tsParserDelete() ``` -------------------------------- ### Set Parser Language to Rust Source: https://context7.com/genotrance/nimtreesitter/llms.txt Configure the parser to use the Rust grammar. This is useful for building Rust code analysis and transformation tools. The `treeSitterrust()` function returns a pointer to the Rust language definition. ```nim import treesitter/api import treesitter_rust/rust var parser = tsParserNew() # Configure parser for Rust language assert parser.tsParserSetLanguage(treeSitterrust()) == true # Parser is now ready to parse Rust source code parser.tsParserDelete() ``` -------------------------------- ### Set Parser Language to C Source: https://context7.com/genotrance/nimtreesitter/llms.txt Configure the parser to use the C grammar. The `treeSitterc()` function returns a pointer to the C language definition. The function returns `true` if the language was successfully set. ```nim import treesitter/api import treesitter_c/c var parser = tsParserNew() # Set the parser to parse C code let success = parser.tsParserSetLanguage(treeSitterc()) assert success == true # Parser is now ready to parse C source code parser.tsParserDelete() ``` -------------------------------- ### Set Parser Language to JavaScript Source: https://context7.com/genotrance/nimtreesitter/llms.txt Configure the parser to use the JavaScript grammar. The JavaScript grammar supports modern ES6+ syntax. The `treeSitterjavascript()` function returns a pointer to the JavaScript language definition. ```nim import treesitter/api import treesitter_javascript/javascript var parser = tsParserNew() # Configure parser for JavaScript language assert parser.tsParserSetLanguage(treeSitterjavascript()) == true # Parser is now ready to parse JavaScript source code parser.tsParserDelete() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.