Move dynamic stuff out of Cont and into two stacks so that Cont is good for resuming traces (having them depend only on code). Remove currently unneeded IDs from Symbol and Pair. Added an InlinePrim Op to tracing, and a nc: Cont to Call. IDs are probs only for trace points now (function starts and side-exits).

This commit is contained in:
2023-12-26 01:03:56 -05:00
parent b40c928026
commit 88e3fa9d39
2 changed files with 88 additions and 56 deletions

View File

@@ -7,17 +7,17 @@ grammar;
pub Term: Rc<Form> = {
NUM => Rc::new(Form::Int(i32::from_str(<>).unwrap())),
SYM => Rc::new(Form::Symbol(<>.to_owned(),RefCell::new(None))),
SYM => Rc::new(Form::Symbol(<>.to_owned())),
"(" <ListInside?> ")" => <>.unwrap_or(Rc::new(Form::Nil)),
"'" <Term> => Rc::new(Form::Pair(Rc::new(Form::Symbol("quote".to_owned(),RefCell::new(None))), Rc::new(Form::Pair(<>, Rc::new(Form::Nil),RefCell::new(None))),RefCell::new(None))),
"'" <Term> => Rc::new(Form::Pair(Rc::new(Form::Symbol("quote".to_owned())), Rc::new(Form::Pair(<>, Rc::new(Form::Nil))))),
"!" <h: Term> <t: Term> => {
h.append(t).unwrap()
},
};
ListInside: Rc<Form> = {
<Term> => Rc::new(Form::Pair(<>, Rc::new(Form::Nil),RefCell::new(None))),
<h: Term> <t: ListInside> => Rc::new(Form::Pair(h, t,RefCell::new(None))),
<a: Term> "." <d: Term> => Rc::new(Form::Pair(a, d,RefCell::new(None))),
<Term> => Rc::new(Form::Pair(<>, Rc::new(Form::Nil))),
<h: Term> <t: ListInside> => Rc::new(Form::Pair(h, t)),
<a: Term> "." <d: Term> => Rc::new(Form::Pair(a, d)),
}
match {
"(",