Skip to content

Commit

Permalink
pretty printer for better readability for testing (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
butterunderflow committed Jun 8, 2024
1 parent 7de3431 commit ea0e5c2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/typing/render.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
open Typedtree
module Fmt = Format

module type PPConfig = sig end

module MakePP (Config : PPConfig) = struct
let rec pp_expr (fmt : Format.formatter) (e : expr) =
match e with
| EConst (CBool b, _) -> Fmt.pp_print_bool fmt b
| EConst (CInt i, _) -> Fmt.pp_print_int fmt i
| EConst (CString s, _) ->
Fmt.pp_print_string fmt (Printf.sprintf "\"%s\"" s)
| EVar (_, _) -> _
| ELet (_, _, _, _) -> _
| ELetrec (_, _, _) -> _
| ELam _ -> _
| EIf (_, _, _, _) -> _
| ECase (_, _, _) -> _
| EApp (_, _, _) -> _
| EAnn (_, _) -> _
| ETuple (_, _) -> _
| EField (_, _, _) -> _
| ECons (_, _) -> _
| EFieldCons (_, _, _) -> _
end

0 comments on commit ea0e5c2

Please sign in to comment.