22 lines
425 B
OCaml
22 lines
425 B
OCaml
open Expr
|
|
|
|
(* fonction d'affichage *)
|
|
let rec affiche_expr e =
|
|
let aff_aux s a b =
|
|
begin
|
|
print_string s;
|
|
affiche_expr a;
|
|
print_string ", ";
|
|
affiche_expr b;
|
|
print_string ")"
|
|
end
|
|
in
|
|
match e with
|
|
| Const k -> print_int k
|
|
| Add(e1,e2) -> aff_aux "Add(" e1 e2
|
|
| Mul(e1,e2) -> aff_aux "Mul(" e1 e2
|
|
| Min(e1,e2) -> aff_aux "Min(" e1 e2
|
|
|
|
let affiche_val v = print_string "TODO"
|
|
|