Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettyprinter #554

Merged
merged 23 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions dag_in_context/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dag_in_context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ symbol_table = { version = "0.3.0", features = ["global"] }
rpds = "1.1.0"
log = "0.4"
env_logger = "0.11.3"
insta = { version = "1.31.0", features = ["yaml"] }
1 change: 1 addition & 0 deletions dag_in_context/src/add_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ impl Expr {
out_ty.clone(),
body.add_ctx_with_cache(current_ctx, cache),
)),
Expr::Symbolic(_) => panic!("found symbol"),
};
cache
.with_ctx
Expand Down
2 changes: 1 addition & 1 deletion dag_in_context/src/from_egglog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<'a> FromEgglog<'a> {
})
}

pub(crate) fn expr_from_egglog(&mut self, expr: Term) -> RcExpr {
pub fn expr_from_egglog(&mut self, expr: Term) -> RcExpr {
if let Some(expr) = self.conversion_cache.get(&expr) {
return expr.clone();
}
Expand Down
1 change: 1 addition & 0 deletions dag_in_context/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ impl<'a> VirtualMachine<'a> {
let e_val = self.interpret_expr(e, arg);
self.interpret_call(func_name, &e_val)
}
Expr::Symbolic(_) => panic!("found symbolic"),
};
self.eval_cache.insert(Rc::as_ptr(expr), res.clone());
res
Expand Down
3 changes: 2 additions & 1 deletion dag_in_context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub(crate) mod type_analysis;
pub mod typechecker;
pub(crate) mod utility;
use main_error::MainError;
pub mod pretty_print;
pub mod schedule;

pub type Result = std::result::Result<(), MainError>;
Expand Down Expand Up @@ -105,7 +106,7 @@ fn print_with_intermediate_helper(
}
}

pub(crate) fn print_with_intermediate_vars(termdag: &TermDag, term: Term) -> String {
pub fn print_with_intermediate_vars(termdag: &TermDag, term: Term) -> String {
let mut printed = String::new();
let mut cache = HashMap::<Term, String>::new();
let res = print_with_intermediate_helper(termdag, term, &mut cache, &mut printed);
Expand Down
1 change: 1 addition & 0 deletions dag_in_context/src/linearity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl<'a> Extractor<'a> {
self.find_effectful_nodes_in_region(body, linearity)
}
Expr::Const(_, _, _) => panic!("Const has no effect"),
Expr::Symbolic(_) => panic!("found symbolic"),
}
}

Expand Down
Loading
Loading