flan/bin/main.ml
2026-09-10 14:40:34 +07:00

19 lines
622 B
OCaml

(* flan — milestone 2 driver. Right now: read a file and print the forms back,
which is the first thing worth having and the first thing worth testing. *)
let () =
match Array.to_list Sys.argv with
| _ :: "read" :: files when files <> [] ->
List.iter
(fun path ->
try
Flan.Reader.read_file path
|> List.iter (fun f -> print_endline (Flan.Form.to_string f))
with Flan.Loc.Error (loc, msg) ->
Printf.eprintf "%s: %s\n" (Flan.Loc.to_string loc) msg;
exit 1)
files
| _ ->
prerr_endline "usage: flan read <file.flan>...";
exit 2