9 releases

0.2.0 Oct 5, 2019
0.1.2 Sep 26, 2019
0.0.6 Sep 7, 2019
0.0.1 Aug 28, 2019

#1019 in Embedded development


Used in 2 crates (via rust-forth-compiler)

MIT license

445KB
13K SLoC

Forth 12K SLoC // 0.2% comments Rust 354 SLoC // 0.0% comments

rust-forth-tokenizer

A Forth tokenizer written in Rust

Usage:

main() { use rust_forth_tokenizer::ForthToken; use rust_forth_tokenizer::ForthTokenizer;

 let tokenizer = ForthTokenizer::new("word : wordname 1 2 3 ; definition");
 // The code also supports the regular for loop iterator syntax
 let collected: Vec<_> = tokenizer.into_iter().collect();
 assert_eq!(
        &collected,
        &vec![
            ForthToken::Command("word"),
            ForthToken::Colon,
            ForthToken::Command("wordname"),
            ForthToken::Number(1),
            ForthToken::Number(2),
            ForthToken::Number(3),
            ForthToken::SemiColon,
            ForthToken::Command("definition"),
        ]
    );    

}

No runtime deps