chc4 / lineiform

A meta-JIT library for Rust interpreters
159 stars 4 forks source link

Recursive example incomplete? #1

Closed phorward closed 3 years ago

phorward commented 3 years ago

Hey! Shouldn't your README.md example for the recursive evaluation state

fn eval(ast: Ast) -> usize {
    match ast {
        Literal(l) => l,
        Add(left, right) => eval(left) + eval(right),  // <-- recursive call to eval missing!
    }
}

let val = eval(Add(Literal(1), Literal(2)));
val // 3

?

chc4 commented 3 years ago

Woops, you're right - I copy pasted that part from a draft with a friend, where I manually corrected it in the actual conversation but not in my draft txt file. Nice catch!