Backup commit before crunch

This commit is contained in:
2023-05-16 18:32:25 +01:00
parent 33413b2b0f
commit 126494c63f
59 changed files with 847 additions and 236 deletions

View File

@@ -82,7 +82,10 @@ pub fn apply(
(new_xpr.clause.clone(), (ctx.gas.map(|x| x - 1), false))
} else {(body.expr().clause.clone(), (ctx.gas, false))}),
Clause::Constant(name) => {
let symval = ctx.symbols.get(name).expect("missing symbol for function").clone();
let symval = if let Some(sym) = ctx.symbols.get(name) {sym.clone()}
else { panic!("missing symbol for function {}",
ctx.interner.extern_vec(*name).join("::")
)};
Ok((Clause::Apply { f: symval, x, }, (ctx.gas, false)))
}
Clause::P(Primitive::Atom(atom)) => { // take a step in expanding atom

View File

@@ -1,11 +1,12 @@
use hashbrown::HashMap;
use crate::representations::interpreted::ExprInst;
use crate::interner::Token;
use crate::interner::{Token, Interner};
#[derive(Clone)]
pub struct Context<'a> {
pub symbols: &'a HashMap<Token<Vec<Token<String>>>, ExprInst>,
pub interner: &'a Interner,
pub gas: Option<usize>,
}