2 releases

0.0.2 Mar 2, 2022
0.0.1 Nov 15, 2021

#275 in Parser tooling

MIT/Apache

195KB
4.5K SLoC

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

Dependencies

~2.2–3MB
~55K SLoC