blob: db9a76f3a4bd606b2c8867928c3acfbe53358d4a (
plain) (
blame)
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
|
open Ast
open Util
(* Utility : find declaration of a const / a node *)
let find_const_decl p id =
match List.find (function
| AST_const_decl (c, _) when c.name = id -> true
| _ -> false)
p with
| AST_const_decl d -> d
| _ -> assert false
let find_node_decl p id =
match List.find (function
| AST_node_decl (c, _) when c.name = id -> true
| _ -> false)
p with
| AST_node_decl d -> d
| _ -> assert false
let extract_const_decls =
List.fold_left
(fun l d -> match d with
| AST_const_decl d -> d::l
| _ -> l)
[]
(* Some errors *)
let combinatorial_cycle v = error ("Combinatorial cycle with variable: " ^ v)
let no_variable e = error ("No such variable: " ^ e)
let type_error e = error ("Type error: " ^ e)
let not_implemented e = error ("Not implemented: " ^ e)
|