feat: Add compact AST dump

Introduce a new `dump_ast_compact` function for the environment and
Dumper. This function provides a simplified, human-readable
representation of the AST, focusing on inferred types and purity markers
instead of detailed debug information.

This change adds:
- A `compact` flag to the `Dumper` struct.
- The `dump_compact` method to the `Dumper`.
- The `dump_ast_compact` method to the `Environment`.
- A new `dump_ast_compact` command-line argument for the `ast` binary.
- A new MCP server endpoint `dump_ast_compact`.
- A `CompactMetadata` trait to abstract over different metadata types
  for compact display.
- Updates to documentation and CLI help messages.
This commit is contained in:
2026-03-29 18:28:10 +02:00
parent 10a7fcb576
commit 0e806b9e5d
6 changed files with 156 additions and 23 deletions
+10 -1
View File
@@ -26,10 +26,14 @@ struct Cli {
#[arg(short, long)]
update_bench: bool,
/// Dump the compiled AST
/// Dump the compiled AST (verbose debug format)
#[arg(short, long)]
dump: bool,
/// Dump the compiled AST in compact, human-readable format (types + purity)
#[arg(long)]
dump_compact: bool,
/// Run with TracingObserver enabled
#[arg(short, long)]
trace: bool,
@@ -129,6 +133,11 @@ fn main() {
Ok(dump) => println!("{}", dump),
Err(e) => eprintln!("Error dumping AST: {}", e),
}
} else if cli.dump_compact {
match env.dump_ast_compact(&content) {
Ok(dump) => println!("{}", dump),
Err(e) => eprintln!("Error dumping AST: {}", e),
}
} else if cli.trace {
execute_trace(&env, &content);
} else {