core_ast: removed letrec. we now treat it as let + set.
All checks were successful
ci/woodpecker/push/debian Pipeline was successful
ci/woodpecker/push/nix Pipeline was successful
ci/woodpecker/push/fedora Pipeline was successful
ci/woodpecker/cron/fedora Pipeline was successful
ci/woodpecker/cron/debian Pipeline was successful
ci/woodpecker/cron/nix Pipeline was successful

This commit is contained in:
2026-02-02 22:36:55 +03:00
parent 7402a688c7
commit 3a3bf2c674
2 changed files with 15 additions and 26 deletions

View File

@@ -1,23 +1,4 @@
open Parser.Ast;;
let p = Printf.sprintf
let rec dbg_print = function
| LSymbol s -> p "%s" s
| LCons (a, LNil) -> p "%s)" (dbg_print_start a)
| LCons (a, b) -> p "%s %s" (dbg_print_start a) (dbg_print b)
| LNil -> p "()"
| LInt i -> p "%d" i
| LDouble d -> p "%f" d
| LString s -> p "%s" s
and dbg_print_start = function
| LCons (_, _) as l -> p "(%s" (dbg_print l)
| _ as x -> dbg_print x
let def = Parser.parse_str "(define (f)
(let ((x 5))
(if t (set! x (+ x 1)))))
@@ -28,9 +9,6 @@ let def = Parser.parse_str "(define (f)
((> 1 2) 0)
((> 3 2) 3)
(t -1))";;
let desugared = List.map Compiler.Sugar.desugar def
let () = List.iter (fun x -> Printf.printf "%s\n" (dbg_print_start x) ) desugared
let () = print_newline ()
let ( let* ) = Result.bind;;
let e =