Fixing some showstoppers

- inertness now tracked separately from gas
- atomic_impl now correctly rolls over when the argument is inert
- syntax fixes
- tree shaking
This commit is contained in:
2023-05-08 20:27:52 +01:00
parent a604e40bad
commit 6a381c5b57
28 changed files with 112 additions and 445 deletions

View File

@@ -112,7 +112,7 @@ pub fn run_dir(dir: &Path) {
match repo.step(&tree) {
None => break tree,
Some(phase) => {
// println!("Step {idx}/{macro_timeout}: {}", phase.bundle(&i));
println!("Step {idx}/{macro_timeout}: {}", phase.bundle(&i));
tree = phase;
},
}
@@ -135,9 +135,16 @@ pub fn run_dir(dir: &Path) {
.join(", ")
)
});
let Return{ gas, state } = interpreter::run(entrypoint.clone(), ctx)
let Return{ gas, state, inert } = interpreter::run(entrypoint.clone(), ctx)
.unwrap_or_else(|e| panic!("Runtime error: {}", e));
println!("Settled at {}", state.bundle(&i));
if inert {
println!("Expression not reducible");
println!("Settled at {}", state.expr().clause.bundle(&i));
println!("Remaining gas: {}",
gas.map(|g| g.to_string())
.unwrap_or(String::from(""))
);
}
if gas == Some(0) {println!("Ran out of gas!")}
else {println!("Expression not reducible.")}
}