First barely-working trace replay! Need to clean up, finish implementing, have trace-reply restore traces, jump directly to other traces, eventually inline and concat traces, etc etc

This commit is contained in:
2024-01-03 01:55:40 -05:00
parent 71a2272f34
commit c15e857171
3 changed files with 167 additions and 50 deletions

View File

@@ -6,20 +6,24 @@ use sl::Form;
grammar;
pub Term: Rc<Form> = {
NUM => Rc::new(Form::Int(i32::from_str(<>).unwrap())),
"true" => Form::new_bool(true),
"false" => Form::new_bool(false),
NUM => Form::new_int(i32::from_str(<>).unwrap()),
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())), Rc::new(Form::Pair(<>, Rc::new(Form::Nil))))),
"(" <ListInside?> ")" => <>.unwrap_or(Form::new_nil()),
"'" <Term> => Rc::new(Form::Pair(Rc::new(Form::Symbol("quote".to_owned())), Rc::new(Form::Pair(<>, Form::new_nil())))),
"!" <h: Term> <t: Term> => {
h.append(t).unwrap()
},
};
ListInside: Rc<Form> = {
<Term> => Rc::new(Form::Pair(<>, Rc::new(Form::Nil))),
<Term> => Rc::new(Form::Pair(<>, Form::new_nil())),
<h: Term> <t: ListInside> => Rc::new(Form::Pair(h, t)),
<a: Term> "." <d: Term> => Rc::new(Form::Pair(a, d)),
}
match {
"true",
"false",
"(",
")",
".",