refactor(wpcarro/compiler): Modularize debug fns
Define `debug.ml` and `prettify.ml` to clean-up some code. Change-Id: Iee2e1ed666f2ccb5e56cc50054ca85b8ba513f3b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7078 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
This commit is contained in:
parent
a8876a4cda
commit
1e9c3955bf
7 changed files with 91 additions and 85 deletions
9
users/wpcarro/scratch/compiler/prettify.ml
Normal file
9
users/wpcarro/scratch/compiler/prettify.ml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
open Types
|
||||
|
||||
(* Pretty-print the type, t. *)
|
||||
let rec type' (t : _type) : string =
|
||||
match t with
|
||||
| TypeInt -> "Integer"
|
||||
| TypeBool -> "Boolean"
|
||||
| TypeVariable k -> Printf.sprintf "%s" k
|
||||
| TypeArrow (a, b) -> Printf.sprintf "%s -> %s" (type' a) (type' b)
|
||||
Loading…
Add table
Add a link
Reference in a new issue