1 stable release
| 1.1.2 | Dec 27, 2025 |
|---|
#666 in Parser implementations
7,952 downloads per month
Used in 14 crates
(10 directly)
16MB
411K
SLoC
This crate provides Perl language support for the tree-sitter parsing library.
Typically, you will use the LANGUAGE constant to add this language to a
tree-sitter Parser, and then use the parser to parse some code:
let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_perl::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading Perl parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());
tree-sitter-perl
a perl parser using tree-sitter
Getting started
To just generate the parser output
npm run generate
Tests
npm run test
Run examples
npm run example
To build the wasm file
- Run pre-build
npm run pre-build - Run build
npm run build - Generate the wasm file
npm run build-wasm(make sure you are running docker daemon)
Maintenance
After upgrading tree-sitter-cli
- Command to upgrade -
npm i tree-sitter-cli@latest - Then do
npm run update-bindings - Then generate the grammar again
npm run generate
Dependencies
~2.6–4MB
~77K SLoC