wip: formatting

This commit is contained in:
Matthew LeVan 2023-12-07 15:01:08 -05:00
parent 695a878754
commit d8e6db14ef
2 changed files with 28 additions and 26 deletions

View File

@ -12,9 +12,9 @@ edition = "2018"
# Please keep these alphabetized # Please keep these alphabetized
[dependencies] [dependencies]
ares_macros = { path = "../ares_macros" } ares_macros = { path = "../ares_macros" }
assert_no_alloc = "1.1.2" # assert_no_alloc = "1.1.2"
# use this when debugging requires allocation (e.g. eprintln) # use this when debugging requires allocation (e.g. eprintln)
# assert_no_alloc = {version="1.1.2", features=["warn_debug"]} assert_no_alloc = {version="1.1.2", features=["warn_debug"]}
bitvec = "1.0.0" bitvec = "1.0.0"
criterion = "0.4" criterion = "0.4"
either = "1.9.0" either = "1.9.0"

View File

@ -244,7 +244,7 @@ pub fn jet_stir(context: &mut Context, subject: Noun) -> Result {
// +$ edge [p=hair q=(unit [p=* q=nail])] // +$ edge [p=hair q=(unit [p=* q=nail])]
let hair = T(&mut context.stack, &[D(1), D(1)]); let hair = T(&mut context.stack, &[D(1), D(1)]);
let mut par_u = StirPair{ let mut par_u = StirPair {
har: hair, har: hair,
res: D(0), res: D(0),
}; };
@ -257,31 +257,29 @@ pub fn jet_stir(context: &mut Context, subject: Noun) -> Result {
let quq_wag: Noun; let quq_wag: Noun;
// push incremental, succesful [fel] parse results onto stack // push incremental, succesful [fel] parse results onto stack
{ let mut vex = slam(context, fel, tub)?.as_cell()?;
let mut vex = slam(context, fel, tub)?.as_cell()?; let mut p_vex = vex.head();
let mut p_vex = vex.head(); let mut q_vex = vex.tail();
let mut q_vex = vex.tail(); eprintln!("stir: got vex");
eprintln!("stir: got vex"); while !unsafe { q_vex.raw_equals(D(0)) } {
while !unsafe { q_vex.raw_equals(D(0)) } { let puq_vex = q_vex.as_cell()?.head();
let puq_vex = q_vex.as_cell()?.head(); let quq_vex = q_vex.as_cell()?.tail();
let quq_vex = q_vex.as_cell()?.tail();
par_u.har = p_vex; par_u.har = p_vex;
par_u.res = puq_vex; par_u.res = puq_vex;
unsafe { *(context.stack.push::<StirPair>()) = par_u }; unsafe { *(context.stack.push::<StirPair>()) = par_u };
tub = quq_vex; tub = quq_vex;
vex = slam(context, fel, tub)?.as_cell()?; vex = slam(context, fel, tub)?.as_cell()?;
p_vex = vex.head(); p_vex = vex.head();
q_vex = vex.tail(); q_vex = vex.tail();
}
eprintln!("stir: vex loop done");
p_wag = p_vex;
puq_wag = rud;
quq_wag = tub;
} }
eprintln!("stir: vex loop done");
p_wag = p_vex;
puq_wag = rud;
quq_wag = tub;
// unwind the stack, folding parse results into [wag] by way of [raq] // unwind the stack, folding parse results into [wag] by way of [raq]
eprintln!("stir: unwinding stack"); eprintln!("stir: unwinding stack");
@ -289,13 +287,17 @@ pub fn jet_stir(context: &mut Context, subject: Noun) -> Result {
p_wag = util::last(p_wag, puq_wag)?; p_wag = util::last(p_wag, puq_wag)?;
let sam = T(&mut context.stack, &[par_u.res, puq_wag]); let sam = T(&mut context.stack, &[par_u.res, puq_wag]);
puq_wag = slam(context, raq, sam)?; puq_wag = slam(context, raq, sam)?;
unsafe { context.stack.pop::<StirPair>(); }; unsafe {
context.stack.pop::<StirPair>();
};
par_u = unsafe { *(context.stack.top::<StirPair>()) }; par_u = unsafe { *(context.stack.top::<StirPair>()) };
} }
eprintln!("stir: unwind done"); eprintln!("stir: unwind done");
unsafe { context.stack.frame_pop(); }; unsafe {
context.stack.frame_pop();
};
eprintln!("stir: done"); eprintln!("stir: done");
Ok(T(&mut context.stack, &[p_wag, D(0), puq_wag, quq_wag])) Ok(T(&mut context.stack, &[p_wag, D(0), puq_wag, quq_wag]))