oni-comb-toys-rs

Crates.iooni-comb-toys-rs
lib.rsoni-comb-toys-rs
version0.0.2
sourcesrc
created_at2021-11-15 00:43:11.754913
updated_at2022-03-02 13:35:52.679589
descriptionA Rust crate for toys parser
homepage
repositoryhttps://github.com/j5ik2o/oni-comb-rs
max_upload_size
id481923
size39,789
Junichi Kato (j5ik2o)

documentation

README

oni-comb-toys-rs

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);
}

Other implementations

Commit count: 3467

cargo fmt