-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the Typed module #1258
Remove the Typed module #1258
Conversation
ca12e2b
to
3059cad
Compare
3059cad
to
1dd136c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I thought I had already reviewed this one before my vacation but looks like I forgot to finish the review.
Overall looks good — I think the Expr
module was a good boundary for the mk_match
abstraction but I'm OK as is now that we have a single frontend.
src/lib/frontend/translate.ml
Outdated
(* (* TO BE REMOVED *) | ||
let debug_compile_match e cases res = | ||
if Options.get_debug_adt () then begin | ||
Printer.print_dbg ~flushed:false ~module_name:"Expr" | ||
"compilation of: match %a with@ " print e; | ||
let p_list_vars fmt l = | ||
match l with | ||
[] -> () | ||
| [e,_,_] -> Var.print fmt e | ||
| (e,_,_) :: l -> | ||
Format.fprintf fmt "(%a" Var.print e; | ||
List.iter (fun (e,_,_) -> Format.fprintf fmt ", %a" Var.print e) l; | ||
Format.fprintf fmt ")" | ||
in | ||
List.iter | ||
(fun (p, v) -> | ||
match p with | ||
| Typed.Constr {name; args} -> | ||
Printer.print_dbg ~flushed:false ~header:false | ||
"| %a %a -> %a@ " | ||
DE.Term.Const.print name | ||
p_list_vars args | ||
print v; | ||
| Typed.Var x -> | ||
Printer.print_dbg ~flushed:false ~header:false | ||
"| %a -> %a@ " Var.print x print v; | ||
)cases; | ||
Printer.print_dbg ~header:false | ||
"end@ result is: %a" print res; | ||
end *) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(* (* TO BE REMOVED *) | |
let debug_compile_match e cases res = | |
if Options.get_debug_adt () then begin | |
Printer.print_dbg ~flushed:false ~module_name:"Expr" | |
"compilation of: match %a with@ " print e; | |
let p_list_vars fmt l = | |
match l with | |
[] -> () | |
| [e,_,_] -> Var.print fmt e | |
| (e,_,_) :: l -> | |
Format.fprintf fmt "(%a" Var.print e; | |
List.iter (fun (e,_,_) -> Format.fprintf fmt ", %a" Var.print e) l; | |
Format.fprintf fmt ")" | |
in | |
List.iter | |
(fun (p, v) -> | |
match p with | |
| Typed.Constr {name; args} -> | |
Printer.print_dbg ~flushed:false ~header:false | |
"| %a %a -> %a@ " | |
DE.Term.Const.print name | |
p_list_vars args | |
print v; | |
| Typed.Var x -> | |
Printer.print_dbg ~flushed:false ~header:false | |
"| %a -> %a@ " Var.print x print v; | |
)cases; | |
Printer.print_dbg ~header:false | |
"end@ result is: %a" print res; | |
end *) |
src/lib/frontend/translate.ml
Outdated
something else for the definition of: %a" | ||
DE.Ty.Const.print adt | ||
end | ||
module Match = struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: if using local modules for actual implementation work there is an abstraction boundary that should be ideally documented and at least typed.
module Match = struct | |
module Match : sig | |
type pat | |
val mk_pat : DE.term -> pat | |
val make : Expr.t -> (pat * Expr.t) list -> Expr.t | |
end = struct |
I had the same concerns when I have done this modification. |
This argument could have been made to avoid moving the code out of |
This PR removes the output AST of the legacy typechecker. This AST was still used by the compilation of match expressions in
Expr
.