| Crates.io | oni-comb-toys-rs |
| lib.rs | oni-comb-toys-rs |
| version | 0.0.2 |
| created_at | 2021-11-15 00:43:11.754913+00 |
| updated_at | 2022-03-02 13:35:52.679589+00 |
| description | A Rust crate for toys parser |
| homepage | |
| repository | https://github.com/j5ik2o/oni-comb-rs |
| max_upload_size | |
| id | 481923 |
| size | 39,789 |
WIP
A Toys language implementation by oni-comb-rs
Toys is a simple scripting language.
fn main() {
let source = r#"
fn fizz_buzz(i) {
if ((i % 3 == 0) && (i % 5 == 0)) {
println("FizzBuzz");
} else if (i % 3 == 0) {
println("Fizz");
} else if (i % 5 == 0) {
println("Buzz");
} else {
println(i);
}
}
fn main() {
println("----");
for (i in 1 to 100) {
fizz_buzz(i);
}
println("----");
}
"#;
let input = source.chars().collect::<Vec<_>>();
let result = program().parse(&input).to_result().unwrap();
println!("{:?}", result);
Interpreter::new().call_main(result);
}