egraphs-good / eggcc

MIT License
42 stars 8 forks source link

Prettyprinter #554

Closed clyben closed 3 months ago

clyben commented 4 months ago

Add a pretty printer which either output to rust macro or let-binded egglog. Pretty printer could take a string of egglog output and parse it under current schema to RcExpr, or an RcExpr of program, output the rust macro or let-binded egglog. Add runmode PrettyPrint and OptimizedPrettyPrint, which output the rust macro form of original program or optimized program. To make rust macro look better copy it to rust file and "cargo fmt". Though you need to add ".with_arg_types(..)" and "add_ctx()" to make it runnable.

yihozhang commented 3 months ago

action items for this PR after a discussion: