Initial snarf.
[shack.git] / arch / x86 / moogle / ast / moogle_ast_exn.mli
blob70521fa4950c05134fb943f054e2b3b7b365f212
1 (*
2 Exception handler for moogle/kupo AST
3 Copyright (C) 2002,2001 Justin David Smith, Caltech
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 open Format
20 open Symbol
21 open Moogle_ast_type
24 (* exn_loc
25 Position/location information for exception handlers. *)
26 type exn_loc =
27 StringLoc of string * exn_loc
28 | AtomLoc of pos
29 | VarLoc of symbol
32 (* exn
33 The possible exception cases for the AST. *)
34 type exn =
35 ParseError
36 | UnboundVar of symbol
37 | TypeError of Moogle_prog_type.ty * Moogle_prog_type.ty
38 | TypeNotAllowed of Moogle_prog_type.ty
39 | TypeInconsistency1 of Moogle_prog_type.ty
40 | TypeInconsistency2 of Moogle_prog_type.ty * Moogle_prog_type.ty
41 | StringError of string
42 | SysError of string
45 (* ASTException
46 Raise an exception from the AST. *)
47 exception ASTException of exn_loc * exn
50 val vexp_pos : symbol -> exn_loc
51 val exp_pos : pos -> exn_loc
52 val string_pos : string -> exn_loc -> exn_loc
54 val pos_of_operand : ('a, 'b) operand -> pos
55 val pos_of_in_inst : in_inst -> pos
56 val pos_of_out_inst : out_inst -> pos
57 val pos_of_op_restriction : op_restriction -> pos
58 val pos_of_inst_restriction : inst_restriction -> pos
59 val pos_of_arith : arith -> pos
60 val pos_of_clause : clause -> pos
62 val union_pos : pos -> pos -> pos
63 val union_pos_operand_list : pos -> ('a, 'b) operand list -> pos
64 val union_pos_arith_list : pos -> arith list -> pos
65 val union_pos_in_inst_list : pos -> in_inst list -> pos
66 val union_pos_out_inst_list : pos -> out_inst list -> pos
67 val union_pos_op_restriction_list : pos -> op_restriction list -> pos
68 val union_pos_inst_restriction_list : pos -> inst_restriction list -> pos
70 val pp_print_exn_loc : formatter -> exn_loc -> unit
71 val pp_print_exn : formatter -> exn_loc -> exn -> unit
72 val print_exn : exn_loc -> exn -> unit