diff options
author | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-13 14:17:22 +0200 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-13 14:17:22 +0200 |
commit | dedc98b0c14262c53e8573d7fe1dcaa370e43fb5 (patch) | |
tree | ac02f7271b054247984caa8aac13451ba98dc15b /interpret/ast_util.ml | |
parent | f7868083de2f351b5195149870e6e77398da44f9 (diff) | |
download | scade-analyzer-dedc98b0c14262c53e8573d7fe1dcaa370e43fb5.tar.gz scade-analyzer-dedc98b0c14262c53e8573d7fe1dcaa370e43fb5.zip |
Move a lot of things.
Diffstat (limited to 'interpret/ast_util.ml')
-rw-r--r-- | interpret/ast_util.ml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/interpret/ast_util.ml b/interpret/ast_util.ml new file mode 100644 index 0000000..db9a76f --- /dev/null +++ b/interpret/ast_util.ml @@ -0,0 +1,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) + |