Add a validation step back.

This commit is contained in:
2023-01-27 21:41:06 -08:00
parent afcf3c65cd
commit 3333dffa1e
6 changed files with 152 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
use crate::syntax::ast::{Program, Statement, Expression};
use crate::syntax::ast::{Expression, Program, Statement};
impl Program {
pub fn simplify(mut self) -> Self {
@@ -40,10 +40,14 @@ impl Expression {
let new_name = format!("<{}:{}>", base_name, *gensym_index);
*gensym_index += 1;
prereqs.push(Statement::Binding(loc.clone(), new_name.clone(), Expression::Primitive(loc.clone(), prim, new_exprs)));
prereqs.push(Statement::Binding(
loc.clone(),
new_name.clone(),
Expression::Primitive(loc.clone(), prim, new_exprs),
));
(prereqs, Expression::Reference(loc, new_name))
}
}
}
}
}