From 7781e41927247bff9e567a47f9fa1862ed5596e6 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Sat, 6 May 2023 00:01:25 +0200 Subject: cli: Add AST pretty-printing option (--ast-dump) Parsing can be a complex process, and it's not always easy to get a clear picture of what's happening with the AST. This commit adds a new feature to the CLI that allows us to pretty-print the AST (outputs to stdout), making it easier to visualize the tree structure and understand how the parser is working. The new --ast-dump option generates a human-readable representation of the AST, including node types, values, and child relationships. This information can be invaluable for debugging and understanding the parser's behavior. Signed-off-by: Johnny Richard Reviewed-by: Carlos Maniero --- src/ast.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index bdace51..69fc918 100644 --- a/src/ast.h +++ b/src/ast.h @@ -54,7 +54,8 @@ typedef enum ast_binary_operation_kind_t AST_BINOP_ADITION, AST_BINOP_SUBTRACTION, AST_BINOP_MULTIPLICATION, - AST_BINOP_DIVISION + AST_BINOP_DIVISION, + AST_BINOP_N } ast_binary_operation_kind_t; typedef struct ast_binary_operation_t -- cgit v1.2.3