-
Notifications
You must be signed in to change notification settings - Fork 6
/
driver.ml
36 lines (29 loc) · 962 Bytes
/
driver.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
let print_component chan comp =
let doc = Pretty.TAL.p_component comp in
PPrintEngine.ToChannel.pretty 0.8 80 chan doc;
output_string chan "\n";
flush chan
let print_f_expression chan expr =
let doc = Pretty.F.p_exp expr in
PPrintEngine.ToChannel.pretty 0.8 80 chan doc;
output_string chan "\n";
flush chan
let handle_component_file path =
let comp = Parse.parse_file Parse.component_eof path in
print_component stdout comp
let handle_f_expression_file path =
let expr = Parse.parse_file Parse.f_expression_eof path in
print_f_expression stdout expr
let roundtrip_component comp =
let path = "tmp.ftal" in
let chan = open_out path in
print_component chan comp;
close_out chan;
handle_component_file path
let roundtrip_f_expression expr =
let path = "tmp.ftal" in
let chan = open_out path in
print_f_expression chan expr;
close_out chan;
handle_f_expression_file path
let () = handle_component_file Sys.argv.(1)