Crates.io | trees-lang |
lib.rs | trees-lang |
version | 0.2.5 |
created_at | 2025-04-29 12:24:17.801285+00 |
updated_at | 2025-05-04 14:49:04.987169+00 |
description | Official impl of Trees (programming-language), supporting only parsing code now |
homepage | https://crates.io/crates/trees-lang |
repository | https://github.com/Snowman-s/Trees |
max_upload_size | |
id | 1653475 |
size | 39,714 |
trees-lang
is the official implementation of the Trees programming language, currently supporting only parsing features. It provides tools to parse and analyze Trees code, including splitting code into characters, finding blocks, and connecting blocks.
Add the following to your Cargo.toml
:
[dependencies]
trees-lang = "0.2.5"
Here is an example of how to use trees-lang
to parse and connect blocks in Trees code:
use trees_lang::compile::{split_code, find_blocks, connect_blocks, CompileConfig};
let code = vec![
" ".to_owned(),
" ┌───────┐".to_owned(),
" │ abc │ ".to_owned(),
" └───┬───┘ ".to_owned(),
" │ ".to_owned(),
" ┌───┴──┐".to_owned(),
" │ def │ ".to_owned(),
" └──────┘ ".to_owned(),
];
let splited_code = split_code(&code, &CompileConfig::DEFAULT);
let mut blocks = find_blocks(&splited_code, &CompileConfig::DEFAULT);
let head = connect_blocks(&splited_code, &mut blocks, &CompileConfig::DEFAULT).unwrap();
assert_eq!(head.proc_name, "abc".to_owned());
Comprehensive documentation is available at docs.rs/trees-lang.
There are also wiki of Trees languages ... but in Japanese.
This project is licensed under the MIT License.
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
Developed by Snowman-s.