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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
(**************************************************************************)
(* *)
(* The Why platform for program certification *)
(* *)
(* Copyright (C) 2002-2011 *)
(* *)
(* Jean-Christophe FILLIATRE, CNRS & Univ. Paris-sud 11 *)
(* Claude MARCHE, INRIA & Univ. Paris-sud 11 *)
(* Yannick MOY, Univ. Paris-sud 11 *)
(* Romain BARDOU, Univ. Paris-sud 11 *)
(* *)
(* Secondary contributors: *)
(* *)
(* Thierry HUBERT, Univ. Paris-sud 11 (former Caduceus front-end) *)
(* Nicolas ROUSSET, Univ. Paris-sud 11 (on Jessie & Krakatoa) *)
(* Ali AYAD, CNRS & CEA Saclay (floating-point support) *)
(* Sylvie BOLDO, INRIA (floating-point support) *)
(* Jean-Francois COUCHOT, INRIA (sort encodings, hyps pruning) *)
(* Mehdi DOGGUY, Univ. Paris-sud 11 (Why GUI) *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Lesser General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *)
(* *)
(**************************************************************************)
(*s types and environments *)
type accessibility = Apublic | Aprotected | Aprivate | Anone
type base_type =
| Tshort | Tboolean | Tbyte | Tchar | Tint | Tfloat | Tlong | Tdouble
(* native logic types *)
| Tinteger | Treal | Tunit | Tstring
type logic_label =
| LabelName of string
| LabelHere
| LabelOld
| LabelPre
type java_type =
| JTYbase of base_type
| JTYnull (*r type of 'null' *)
| JTYclass of bool * java_class_info (*r first arg true if non_null *)
| JTYinterface of interface_info
| JTYarray of bool * java_type (*r first arg true if non_null *)
| JTYlogic of logic_type_info
and logic_type_info = string
and java_var_info =
{
java_var_info_tag : int;
java_var_info_name : string;
java_var_info_decl_loc : Loc.position;
java_var_info_type : java_type;
mutable java_var_info_final_name : string;
mutable java_var_info_assigned : bool;
}
and java_field_info =
{
java_field_info_tag : int;
java_field_info_name : string;
java_field_info_class_or_interface : java_type_info;
(*
mutable java_field_info_trans_name : string;
java_field_info_accessibility : accessibility;
*)
java_field_info_is_static : bool;
java_field_info_is_final : bool;
java_field_info_is_nullable : bool;
java_field_info_type : java_type;
java_field_info_is_ghost : bool;
java_field_info_is_model : bool;
}
and method_info =
{
method_info_tag : int;
method_info_loc : Loc.position;
method_info_name : string;
mutable method_info_trans_name : string;
method_info_is_static : bool;
(*
method_info_accessibility : accessibility;
*)
method_info_class_or_interface : java_type_info;
mutable method_info_has_this : java_var_info option;
method_info_parameters : (java_var_info * (* nullable *) bool) list;
method_info_result : java_var_info option ;
method_info_result_is_nullable : bool ;
mutable method_info_calls : method_or_constructor_info list;
}
and constructor_info =
{
constr_info_tag : int;
constr_info_loc : Loc.position;
constr_info_class : java_class_info;
mutable constr_info_trans_name : string;
mutable constr_info_this : java_var_info option;
mutable constr_info_result : java_var_info option;
constr_info_parameters : (java_var_info * (* nullable : *) bool) list;
mutable constr_info_calls : method_or_constructor_info list;
}
and method_or_constructor_info =
| MethodInfo of method_info
| ConstructorInfo of constructor_info
and logic_type_entry =
{
logic_type_entry_name : string
}
and java_logic_info =
{
java_logic_info_name : string;
java_logic_info_tag : int;
java_logic_info_result_type : java_type option;
java_logic_info_labels : logic_label list;
java_logic_info_parameters : java_var_info list;
mutable java_logic_info_calls : java_logic_info list;
}
and axiom_info =
{
axiom_info_name : string;
}
and package_info =
{
package_info_tag : int;
package_info_name : string;
mutable package_info_directories : string list;
}
and java_class_info =
{
class_info_tag : int;
class_info_name : string;
class_info_package_env : package_info list;
mutable class_info_incomplete : bool;
mutable class_info_is_final : bool;
mutable class_info_extends : java_class_info option;
mutable class_info_is_exception : bool;
mutable class_info_implements : interface_info list;
mutable class_info_fields : java_field_info list;
mutable class_info_final_fields : java_field_info list;
mutable class_info_methods : method_info list;
mutable class_info_constructors : constructor_info list;
}
and interface_info =
{
interface_info_tag : int;
interface_info_name : string;
interface_info_package_env : package_info list;
mutable interface_info_incomplete : bool;
mutable interface_info_extends : interface_info list;
mutable interface_info_fields : java_field_info list;
mutable interface_info_final_fields : java_field_info list;
mutable interface_info_methods : method_info list;
}
and java_type_info =
| TypeClass of java_class_info
| TypeInterface of interface_info
(*s literals, shared between ASTs and typed ASTs *)
type float_suffix = [`Single |`Double |`Real]
type literal =
| Integer of string
| Float of string * float_suffix
| Bool of bool
| String of string
| Char of string
| Null
type nonnull_policy =
| NonNullNone (* Java semantics *)
| NonNullFields (* class fields non-null by default *)
| NonNullAll (* class fields and methods parameters & return value non-null by default *)
| NonNullAllLocal (* class fields, methods parameters & return value, and local variables non-null by default *)
(*
Local Variables:
compile-command: "make -C .. bin/krakatoa.byte"
End:
*)
|