rm debug print

This commit is contained in:
2025-08-30 14:53:34 +02:00
parent c4f09d6ca8
commit 63aada8b50

View File

@@ -686,11 +686,6 @@ module SExprMacroExp = struct
let rec eval (ctx: (string * (SExpr.t * SExpr.t)) list) s = let rec eval (ctx: (string * (SExpr.t * SExpr.t)) list) s =
let open SExpr in let open SExpr in
Format.printf "ctx:\n%!";
List.iter begin fun vv ->
let k,v = vv in
Format.printf "- %s = %a%a\n%!" k pp_t (fst v) pp_t (snd v)
end ctx;
let s, ctx = if is_list s then let s, ctx = if is_list s then
aggr_flat_map eval ctx s aggr_flat_map eval ctx s
else else
@@ -701,21 +696,18 @@ module SExprMacroExp = struct
(* expr -> list(new exprs) * bool:changed * ctx *) (* expr -> list(new exprs) * bool:changed * ctx *)
and check_expands ctx s = and check_expands ctx s =
let open SExpr in let open SExpr in
Format.printf "checking: %a\n%!" pp_t s;
match s with match s with
Cons(Id(":macro"), r) -> begin Cons(Id(":macro"), r) -> begin
let a = match r with let a = match r with
Cons(Id(l), Cons(a,b)) -> l, (a,b) Cons(Id(l), Cons(a,b)) -> l, (a,b)
| _ -> raise @@ Misformated_Macro s | _ -> raise @@ Misformated_Macro s
in in
Format.printf "define: %s%a -> %a\n%!" (fst a) pp_t (fst (snd a)) pp_t (snd (snd a));
Nil, false, (a :: ctx) Nil, false, (a :: ctx)
end end
| Cons(Id(i), r) -> begin | Cons(Id(i), r) -> begin
let i = if String.starts_with ~prefix:":" i then let i = if String.starts_with ~prefix:":" i then
String.sub i 1 ((String.length i) - 1) String.sub i 1 ((String.length i) - 1)
else "@" in else "@" in
Format.printf "consider expand %s%a\n%!" i pp_t r;
let rec test opt ctx = let rec test opt ctx =
begin match opt with begin match opt with
[] -> li1 s, false, ctx [] -> li1 s, false, ctx