| 133 |
(fun (n,t) -> Typer.register_global_types [n, mk noloc (Ast.Internal t)]) |
(fun (n,t) -> Typer.register_global_types [n, mk noloc (Ast.Internal t)]) |
| 134 |
Builtin.types |
Builtin.types |
| 135 |
|
|
| 136 |
let run ppf input = |
let () = mk_builtin () |
| 137 |
let typing_env = ref Typer.Env.empty in |
|
| 138 |
let eval_env = ref Eval.Env.empty in |
let typing_env = State.ref "Cduce.typing_env" Typer.Env.empty |
| 139 |
|
let eval_env = State.ref "Cduce.eval_env" Eval.Env.empty |
| 140 |
|
|
| 141 |
|
let run ppf input = |
| 142 |
let insert_type_bindings = |
let insert_type_bindings = |
| 143 |
List.iter (fun (x,t) -> |
List.iter (fun (x,t) -> |
| 144 |
typing_env := Typer.Env.add x t !typing_env; |
typing_env := Typer.Env.add x t !typing_env; |
| 183 |
List.iter eval_decl decls |
List.iter eval_decl decls |
| 184 |
in |
in |
| 185 |
try |
try |
|
mk_builtin (); |
|
| 186 |
let p = |
let p = |
| 187 |
try Parser.prog input |
try Parser.prog input |
| 188 |
with |
with |
| 199 |
) ([],[]) p in |
) ([],[]) p in |
| 200 |
Typer.register_global_types type_decls; |
Typer.register_global_types type_decls; |
| 201 |
do_fun_decls fun_decls; |
do_fun_decls fun_decls; |
| 202 |
List.iter phrase p |
List.iter phrase p; |
| 203 |
|
true |
| 204 |
with |
with |
| 205 |
| (Failure _ | Not_found | Invalid_argument _) as e -> |
| (Failure _ | Not_found | Invalid_argument _) as e -> |
| 206 |
raise e (* To get ocamlrun stack trace *) |
raise e (* To get ocamlrun stack trace *) |
| 207 |
| exn -> print_exn ppf exn |
| exn -> print_exn ppf exn; false |
| 208 |
|
|
| 209 |
|
|