blob: a2c436450dd9969ebf657682240c073f5a2b56d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
let process_item (toplvl : TopLevel.t) (item : Ast.item) : TopLevel.t =
let (name, item) = match item with
| Ast.Def { name; tp; tm } ->
let tp = Elaborator.check_tp_toplevel ~toplvl tp in
let tm = Elaborator.check_toplevel ~toplvl ~tm ~tp in
(name, TopLevel.Def { tp; tm = lazy (NbE.eval_toplevel tm) })
in
Yuujinchou.Trie.update_singleton name.value (fun _ -> Some (item, ())) toplvl
let process_file (path : string) : TopLevel.t =
let file = Parser.parse_file path in
List.fold_left process_item Yuujinchou.Trie.empty file
|