open Scanf let rec expr () = try scanf " %u" (fun n -> n) with Scan_failure _ -> scanf "%c" (function '+' -> expr() + expr() '-' -> let e = expr() in e - expr() '*' -> expr() * expr() '/' -> let e = expr() in e / expr() c -> failwith ("illegal char " ^ (Char.escaped c)) ) let _ = print_int (expr())
This document was generated using caml2html