42 releases

Uses new Rust 2024

0.1.32 May 10, 2025
0.1.31 Jun 2, 2024
0.1.30 May 22, 2024
0.1.29 Feb 18, 2024
0.1.1 Apr 30, 2021

#1607 in Parser implementations

Download history 80/week @ 2025-01-29 70/week @ 2025-02-05 97/week @ 2025-02-12 44/week @ 2025-02-19 77/week @ 2025-02-26 13/week @ 2025-03-05 48/week @ 2025-03-12 31/week @ 2025-03-19 32/week @ 2025-03-26 6/week @ 2025-04-02 34/week @ 2025-04-09 18/week @ 2025-04-16 53/week @ 2025-04-23 29/week @ 2025-04-30 159/week @ 2025-05-07 163/week @ 2025-05-14

407 downloads per month
Used in 5 crates

MIT license

34KB
1K SLoC

Cirru Parser

This tiny parser parses indentation based syntax into nested a vector, then it could used as S-Expressions for evaluation or codegen.

defn fib (x)
if (<= x 2) 1
+
fib $ dec x
fib $ - x 2

parses to:

[ ["defn" "fib" [ "x" ]
[ "if" [ "<=" "x" "2" ] "1"
[ "+" [ "fib" ["dec" "x"] ] [ "fib" ["-" "x" "2"] ] ]
]
] ]

find more on http://text.cirru.org/ .


Cirru Parser in Rust

Usages

Found on crate .

Rust Docs.

cargo install cirru_parser
use cirru_parser::{parse};

parse("defn f (x)\n  x"); // returns Result<Vec<Cirru>, String>

use writer:

use cirru_parser::{format, CirruWriterOptions, escape_cirru_leaf}

let writer_options = CirruWriterOptions { use_inline: false };
format(tree, writer_options); // tree is Vec<Cirru>

escape_cirru_leaf("a b");

License

MIT

Dependencies

~270–550KB
~12K SLoC