add block expressions

This commit is contained in:
Jim 2025-10-21 08:34:21 -04:00
parent c5b045ebcb
commit 3c184a1ac8
Signed by: jim
GPG key ID: 3236D2F059A7C0AC
8 changed files with 129 additions and 54 deletions

View file

@ -4,8 +4,14 @@ use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
use jang::*;
fn bench_parsers(c: &mut Criterion) {
let mut group = c.benchmark_group("Fibonacci");
for input_path in ["programs/medium.jang", "programs/test.jang"].iter() {
let mut group = c.benchmark_group("jang");
for input_path in [
"programs/long.jang",
"programs/medium.jang",
"programs/test.jang",
]
.iter()
{
let src = std::fs::read_to_string(input_path).unwrap();
group.bench_with_input(BenchmarkId::new("Parse", input_path), &src, |b, src| {
@ -17,7 +23,8 @@ fn bench_parsers(c: &mut Criterion) {
return;
};
let mut vars = HashMap::new();
_ = eval(&ast, &mut vars);
let mut scope = Vec::new();
_ = eval(&ast, &mut vars, &mut scope);
})
});
}