#erlang #parser #incremental

tree-sitter-erlang

erlang grammar for the tree-sitter parsing library

7 releases (breaking)

new 0.6.0 May 16, 2024
0.5.0 Mar 18, 2024
0.4.0 Dec 15, 2023
0.3.0 Nov 27, 2023
0.0.1 Oct 20, 2022

#70 in Text editors

Download history 586/week @ 2024-01-30 873/week @ 2024-02-06 1212/week @ 2024-02-13 2591/week @ 2024-02-20 2097/week @ 2024-02-27 1502/week @ 2024-03-05 1399/week @ 2024-03-12 1341/week @ 2024-03-19 825/week @ 2024-03-26 598/week @ 2024-04-02 318/week @ 2024-04-09 108/week @ 2024-04-16 251/week @ 2024-04-23 189/week @ 2024-04-30 109/week @ 2024-05-07 338/week @ 2024-05-14

913 downloads per month

MIT license

1.5MB
53K SLoC

C 52K SLoC JavaScript 845 SLoC // 0.1% comments Scheme 138 SLoC // 0.3% comments Rust 30 SLoC // 0.6% comments

Tree Sitter Erlang

This represents tree-sitter grammar used for the Erlang language in the ELP project.

It started as a direct clone of https://github.com/AbstractMachinesLab/tree-sitter-erlang at 7b436e1ca50f0002f6765a9a2a00f6156b2cc881, but was later heavily modified for completeness.

Usage

Install the required toolchain with

make deps

Edit the grammar.js file and re-generate the code with:

make gen

Useful test command, parses foo.erl and opens a browser window to show the process, with pretty pictures of the generated AST.

npm run parse -- --debug-graph testdata/foo.erl

License

tree-sitter-erlang is Apache licensed.


lib.rs:

This crate provides Erlang language support for the tree-sitter parsing library.

Typically, you will use the language function 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();
parser.set_language(&tree_sitter_erlang::language()).expect("Error loading Erlang grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~2.8–4MB
~72K SLoC